Q for regexp experts
Tim Hochberg
tim.hochberg at ieee.org
Fri Dec 8 10:34:00 EST 2000
I certainly won't claim to be a regexp expert, but:
".*?(?=SEP)"
seems to work. If alternatively you want to match to SEP or end of line:
".*?(?=SEP|\Z)"
seems to do the trick.
-tim
"Harald Kirsch" <kirschh at lionbioscience.com> wrote in message
news:yv2aea77xw2.fsf at lionsp093.lion-ag.de...
>
> 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]*
>
> but this disallows S', 'E' and 'P' in between the separators.
>
> I tried something like (.(?!SEP))+ but it somehow does not work. Is it
> at all possible to get this to work with regular expressions?
>
> Harald Kirsch
>
> --
> ----------------+------------------------------------------------------
> Harald Kirsch | kirschh at lionbioscience.com | "How old is the epsilon?"
> LION Bioscience | +49 6221 4038 172 | -- Paul Erdös
>
More information about the Python-list
mailing list