Re: [MacPerl-AnyPerl] Pattern matching question

2001-12-18 Thread Jean-Francois Jobidon
try this : if($string =~ m/\[(EC:.+?)\]/) { print $1 } On Tuesday, December 18, 2001, at 09:53 AM, Adam Witney wrote: > Hi, > > I am trying to write a simple regex to strip out some text, here is some > sample code > > $string = '[EC:] [SP:]'; > > if($string =~ m/\[(EC:.+)\]/) >

Re: [MacPerl-AnyPerl] Pattern matching question

2001-12-18 Thread Ronald J Kimball
On Tue, Dec 18, 2001 at 02:53:24PM +, Adam Witney wrote: > > 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 [ ? Use a negated character class. m/\[(EC:[^\]]+)\]/ Ron

[MacPerl-AnyPerl] Pattern matching question

2001-12-18 Thread Adam Witney
Hi, I am trying to write a simple regex to strip out some text, here is some sample code $string = '[EC:] [SP:]'; if($string =~ m/\[(EC:.+)\]/) { print $1 } However this returns EC:] [SP: Instead of EC: Basically I want to strip out the contents of the first [], but this seems t