*? = 0 or more, non-greedy.  Non-greeday meaning "as few as possible".

$test = 'foobar foobar';

# matches "foobar foobar", as many of "." as possible.
$test =~ /foo.*bar/;

# matches "foobar", as few of "." as possible (in this case, none).
$test =~ /foo.*?bar/;

Also...

+ = 1 or more (greedy)
+? = 1 or more, non-greedy.

Rob

-----Original Message-----
From: Rob Benton [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 2:07 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Problem with regular expressions!!!


How does it translate?

* = 0 or more of preceding char
? = 1 or 0 of preceding char
*? = ???


On Tue, 2003-03-18 at 21:41, Michael Kelly wrote:
> On Tue, Mar 18, 2003 at 05:53:45PM -0600, Rob Benton wrote:
> > It looks odd to me b/c * and ? are both quantifiers...
> 
> * and ? alone are both quantifiers, but *? is a non-greedy *.
> 
> -- 
> Michael
> [EMAIL PROTECTED]
> http://www.jedimike.net/
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to