Positive lookahead assertion

tobiah st at tobiah.org
Thu Sep 7 16:38:07 EDT 2006


>> Posted via a free Usenet account from http://www.teranews.com
> Its all about context. If you want to match something but only if it
> precedes something else, then you follow the regular expression for
> 'something' by the regular expression for 'something else' where
> `something else` is enclosed by (?=...)
> 
> The regular expression engine will surreptitiously check that
> 'something else' does indeed follow, before returning any match of
> 'something'.


How would this differ from just

re.search('somethingsomething else')

-- 
Posted via a free Usenet account from http://www.teranews.com




More information about the Python-list mailing list