Q for regexp experts
Ludwig Callewaert
ludwig_callewaert at frontierd.com
Fri Dec 8 10:24:45 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. 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
What about:
set s "the longest matching String not containing SEP"
regexp -- ".*(?=SEP)" $s match
puts $match
> the longest matching String not containing
Ludwig
--
Ludwig Callewaert e-mail: ludwig_callewaert at frontierd.com
Senior Software Engineer Frontier Design, Belgium
__________________________________________________________________
More information about the Python-list
mailing list