On Thu, Sep 18, 2008 at 01:47:05PM -0700, DM666 wrote:
> 
> I would like to match any occurrence of this chunk of text, i.e.,
> everything between "<filter>" and "</filter>" tags, with a match on
> the string "<name>Shift Fields</name>" (without the quotes). As you
> can see, there are line breaks, tabs, and various chunks of text
> before and after the string within the matching filter tags.

This is a bit tricky, actually.  You need to match <filter> tags that
contain specific text, without matching across multiple <filter> tags.

If you just do this:

(?s)<filter>.*?<name>Shift Fields</name>.*?</filter>

Then you could match the beginning of one filter, and continue into the
next filter that has the appropriate name.

However, you can do this:

(?s)<filter>(?:(?!</filter>).)*<name>Shift Fields</name>.*?</filter>

The (?:(?!</filter>).)* part matches one character at a time, making sure
the next part of the string is not </filter>.

HTH,
Ronald

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to "[EMAIL PROTECTED]" 
rather than posting to the group.
-~----------~----~----~----~------~----~------~--~---

Reply via email to