Q for regexp experts

Bob Techentin techentin.robert at mayo.edu
Fri Dec 8 10:23:53 EST 2000


Harald Kirsch wrote:
> 
> Even with perl-compatible regular expressions it seems to be
> impossible to specify a pattern which matches
> 
>    `the longest substring not containing separator' SEP
> 
> Put another way, from a given starting point, the pattern shall match
> everything until just before the next occurence of SEP. 

Try a non-greedy match on .*, followed by a literal SEP.

	regexp {(.*?)SEP} $string matchvar firstpart

Bob
-- 
Bob Techentin                        techentin.robert at mayo.edu 
Mayo Foundation                                 (507) 284-2702 
4001 41st St. NW          (After Jan 1, 2000)   (507) 538-5495 
Rochester MN, 55901  USA            http://www.mayo.edu/sppdg/



More information about the Python-list mailing list