[Tutor] Regex

Andrei project5 at redrival.net
Sun Aug 24 21:34:29 EDT 2003


I'm quite sure I've seen a question of this type before, but I seem 
unable to find it. How can I match a re pattern ONLY if it is not 
preceded by another re pattern? I know how to construct both individual 
regexes, but I don't know how to glue them together in order to achieve 
this.

Think for example of finding all URLs in a piece of text, but *not* if 
they are inside link tags and therefore preceded by 'href="'.
<a href="http://python.org">Python</a> shouldn't give a match, but 
http://python.org on its own should.

Andrei

=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at bcrenznvy.pbz. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V 
ernq gur yvfg, fb gurer'f ab arrq gb PP.





More information about the Tutor mailing list