[Israel.pm] regex questions

David Baird david.baird at cmcrossroads.com
Mon Jul 19 06:31:09 PDT 2004


> 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




More information about the Perl mailing list