On May 22, 2011, at 1:36, ChristianBoyce <[email protected]> wrote: > I am going to have some text that is HTML tags and other text that is > not. I simply want to skip over the stuff that is HTML tags. Sounds > easy-- if it's inside of angle brackets, don't change it. > > Example: > > <A HREF="http://www.drseuss.com/THE-CAT-IN-THE-HAT.png">THE-CAT-IN-THE- > HAT</A> becomes > <A HREF="http://www.drseuss.com/THE-CAT-IN-THE-HAT.png">the-cat-in-the- > hat</A> > > The problem is, I can't figure out how to say "if it's in angle > brackets, don't change it." There is no telling what will be inside > those brackets.
There is no way to get a regex to do what you want since you don't know how many urls there will be in the selected text. You will need a script of some sort (perl, AppleScript, &c). the good news, it's a pretty simple script. Basically, you iterate over the text looking for <([:alpha:]) and then lowercase the text you found up to that point, then look for an [:alpha:] or / followed by a >, then start searching forward again. When you get to the end of the text, you're done. There will still be issues, but those are edge cases you probably don't need to take the trouble to program around: a<b+6 for example. -- You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups. To post to this group, send email to [email protected] 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 feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
