patgas has asked for the wisdom of the Perl Monks concerning the following question:
I'm extracting some information from a line in a data file, and I came up with following regex to do it. I have two questions: What would break it, and why doesn't $title have the space in between END OF CENTURY and <BASIC> ? I'd have thought that using the negated character class to grab END OF CENTURY would take everything up until the next <, but it knows to leave out the space immediately before.
$_ = "(KONAMI ORIGINAL) END OF THE CENTURY <BASIC> / NO.9"; m|^\(([^\)]*)\) ([^<]*) <([^>]*)> / (.*)$|; ( $source, $title, $mode, $artist ) = ( $1, $2, $3, $4 ); print ">$source< >$title< >$mode< >$artist<\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Break my regex, please
by davorg (Chancellor) on Oct 30, 2001 at 20:17 UTC | |
|
Re: Break my regex, please
by tommyw (Hermit) on Oct 30, 2001 at 20:20 UTC | |
|
Re: Break my regex, please
by doc (Scribe) on Oct 30, 2001 at 20:32 UTC | |
|
(jeffa) Re: Break my regex, please
by jeffa (Bishop) on Oct 30, 2001 at 20:21 UTC |