Loading ...
Sorry, an error occurred while loading the content.

Clip Using RegEx to Strip ID Information

Expand Messages
  • Wiles, Carolyn M
    I have a number of SGML/XML files where a proprietary tool IDs the tags. I can reuse a lot of my work, but I have to strip those IDs because it sees them as
    Message 1 of 3 , Jan 3, 2007
    • 0 Attachment
      I have a number of SGML/XML files where a proprietary tool IDs the tags. I
      can reuse a lot of my work, but I have to strip those IDs because it sees
      them as duplicates even if they are in a different procedure. I have been
      manually cleaning up the IDs, because I understand the basics of RegEx but
      not how to put it in to action (I am currently using Notetab Light 4.95). I
      can read a clip and garner a basic knowledge of what is happening, but up to
      this point I haven't done a whole lot of work with clips or RegEx.



      Here is an example (it doesn't have to be step, it could be another tag -
      but the ID information is constantly changing):



      <step id="A00001" vid="1" fvid="1">



      What I want to do is to be able to strip from space id to the end tag for
      every tag (in this case, I would be left with <step>). In all cases, the
      information will be proceeded by "id" in the tag. In every case, no matter
      how many variables are in between, I would want to strip from the id to the
      end tag. Can someone walk me through the process of doing a clip and
      running it on my files for a case such as this).



      Thanks.



      Cara



      Cara Wiles

      BAE Systems

      Technical Writer

      Technical Support Services

      Carolyn.Wiles@... <mailto:Carolyn.Wiles@...>

      Phone (301) 231-2322

      Fax (301) 231-2202







      [Non-text portions of this message have been removed]
    • buralex@gmail.com
      ... H= trim step ^!replace rwasi copy two lines above, in Notetab ... right-click on Clipbar header, (F4 to display it) create new
      Message 2 of 3 , Jan 3, 2007
      • 0 Attachment
        Carolyn:
        > What I want to do is to be able to strip from space id to the end tag for
        > every tag (in this case, I would be left with ). In all cases, the
        > information will be proceeded by "id" in the tag. In every case, no matter
        > how many variables are in between, I would want to strip from the id
        > to the
        > end tag. Can someone walk me through the process of doing a clip and
        > running it on my files for a case such as this).
        > <step id="A00001" vid="1" fvid="1"> ===> <step>
        H="trim step"
        ^!replace "<step .*>" >> "<step>" rwasi

        copy two lines above,
        in Notetab ...
        right-click on Clipbar header, (F4 to display it)
        create new Library (name it myClips), ,
        right-click below header select Add from Clipboard

        above should work in either Notetab 4.x or 5.x (not tested)

        Regards ... Alec -- buralex-gmail
        --



        [Non-text portions of this message have been removed]
      • Alan_C
        On Wednesday 03 January 2007 15:23, Wiles, Carolyn M wrote: ... All below are untested. And, if your tag(s) span lines (tag is not only on one line)
        Message 3 of 3 , Jan 3, 2007
        • 0 Attachment
          On Wednesday 03 January 2007 15:23, Wiles, Carolyn M wrote:
          <snip>
          > Here is an example (it doesn't have to be step, it could be another tag -
          > but the ID information is constantly changing):
          >
          > <step id="A00001" vid="1" fvid="1">
          >
          > What I want to do is to be able to strip from space id to the end tag for
          > every tag (in this case, I would be left with <step>). In all cases, the
          > information will be proceeded by "id" in the tag. In every case, no matter
          > how many variables are in between, I would want to strip from the id to the
          > end tag. Can someone walk me through the process of doing a clip and
          > running it on my files for a case such as this).

          All below are untested. And, if your tag(s) span lines (tag is not only on
          one line) then you need yet even a more complex regex than these.

          The below, SPACEid is *not*much** with which to use as find info (too easy
          to also match in places you don't want it to match?) -- thus, may better to
          use (be more specific) like so:

          "(<step) id.+(>)"

          or

          "(<whichever_tag) id.+(>)"

          Here's some more ideas:

          if is Version 5.1 Notetab:

          ^!Replace "(<.+) id.+(>)" >> "$1$2" RISAW

          if is version 4.95 Notetab:

          ^!Replace "{<.+} id.+{>}" >> "/1/2" RISAW

          but the 4.95 may not work adequately due to the 4.95 regex greed issue.

          --
          Alan.
        Your message has been successfully submitted and would be delivered to recipients shortly.