Pattern matching question
[email protected] (Adam Witney) Tue, 18 Dec 2001 14:53:24 +0000
| Newsgroups | perl.macperl.anyperl |
|---|---|
| Message-ID | <B84508E4.840%[email protected]> |
Hi,
I am trying to write a simple regex to strip out some text, here is some
sample code
$string = '[EC:<stuff>] [SP:<stuff>]';
if($string =~ m/\[(EC:.+)\]/)
{
print $1
}
However this returns
EC:<stuff>] [SP:<stuff>
Instead of
EC:<stuff>
Basically I want to strip out the contents of the first [], but this seems
to be matching from the outside in. Is there a way to make it look for the
first ] after the [ ?
Thanks for any help
adam