RegExp Lazy Quantifiers

Post Reply
jskibbie
Newbie
Posts: 10
Joined: Mon Jan 23, 2012 8:34 pm

RegExp Lazy Quantifiers

Post by jskibbie »

Is there a way to do a lazy quantifier in Switch using .*?

When I try to isolate the value "Some Value" from the string below using the lazy quantifier .*? I don't get any match.

Code: Select all

var str = 'Some Value / Some Other Value / Yet Another Value /';
re = /(.*?)\s\//;
job.log (-1, re.search(str)  );
job.log (-1, "cap: " + re.cap(0) );
I could split the string on " / ", but do lazy quantifiers not exist in Switch's RegExp Engine?

Thanks.
Jim
User avatar
andrea mahoney
Newbie
Posts: 19
Joined: Tue Jan 25, 2011 8:53 pm

Re: RegExp Lazy Quantifiers

Post by andrea mahoney »

Hi,

I changed it to var re = /([\d\w\s]+)\s\//;
and this returned: cap: Some Value /

the .* would not work for me either
Post Reply