Thanks,
I still have to check if it good for me, but since
(Nav)?
matches empty string, then
(.*?)
can "eat" everything untill the end (including any "Nav").
Correct ?
"David Baird"
<david.baird at cmcros To: "'Perl in Israel'" <perl at perl.org.il>
sroads.com> cc:
Sent by: Subject: RE: [Israel.pm] regex questions
perl-bounces at perl.o
rg.il
07/19/2004 16:31
Please respond to
Perl in Israel
> We have a text containing lines such as:
>
> [DBACBNav]
> [DBACB]
> [DBZXYNav]
> [DBZXY]
> ..
> ..
>
> We would like to capture the string that comes after "DB" but
> without the
> "Nav" - if it exists.
m{\[DB(.*?)(Nav)?\]}
And $1 always has your match.
Get "The Regex Coach" for Windows to debug your regex.
http://weitz.de/regex-coach/
-David
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl