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

6495Re: [NH] find/replace in tags

Expand Messages
  • Marcelo de Castro Bastos
    Oct 6, 2008
    • 0 Attachment
      Interviewed by CNN on 6/10/2008 21:39, Don Strack told the world:
      >> --------------------------------------------------
      >> Reg. Exp.: \<td class\="[^"]*"\>([^<]*)\</td\>
      >> Replace with: <td>$1</td>
      >> [ ] Case Sensitive [x] Regular Exp.
      >> --------------------------------------------------
      >> Does this help?
      >> I suggest you dive into Regular Expressions. The NTP help file
      >> contains
      >> some hints, and you might find some links to tutorials here:
      >> http://en.wikipedia.org/wiki/Regular_expression
      > I guess I asked the wrong question. What I meant to ask was:
      > How do I strip everything from inside the <td> tags. I tried the above
      > string, I'm not able to figure out what to leave in and what to take out.
      > I see what the \ before the various characters does, to maintain the
      > <td> and </td>, and the " part of the class=, but what do the other
      > parts do?
      > [^"]*
      > and
      > ([^<]*)
      OK, let's take one detail at a time.
      Square brackets define a "class" of characters. Meaning that they match
      any character that belongs to that class.
      The "^" as the first character inside the square brackets INVERTS the
      definition of the class. Thus, [^"] means "any character EXCEPT double
      The asterisk means "0 or more occurrences of the thing that comes
      before". So, [^"]* will match any string that does NOT contain a double
      quote -- that is, it will match everything from the point it begins
      until it finds a double quote (the double quote will "stay outside" of
      the match, so to speak).

      The parentheses assign whatever matched the string inside to a variable.
      So, the second example will find a string that ends just before the next
      HTML tag, and assign it to a variable. Then, in the "replace" field, you
      can use a token (like $1) to insert back that string.

      This is explained in the "Help on Regular Expressions" in the NoteTab
      Help menu. There are also lots of places around the Web where you can
      find more about regular expressions.

      Jury: Twelve people who decide who has the better lawyer
      * TagZilla 0.066 on Seamonkey 1.1.12
    • Show all 6 messages in this topic