Q for regexp experts

François Granger francois.granger at free.fr
Fri Dec 8 15:32:33 EST 2000


Harald Kirsch <kirschh at lionbioscience.com> 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. A first
> attempt is something like
> 
>    [^SEP]*

Stupid idea:

temp = string.split(string, 'SEP')
for string in temp:
    'do what you need with string'
for i in range(len(temp)):
    temp[i]

-- 
"Nous autres, civilisations, nous savons maintenant que nous sommes 
mortelles"
- Paul Valéry 1919



More information about the Python-list mailing list