Page 1 of 1

RegExp Lazy Quantifiers

Posted: Mon Mar 30, 2015 7:30 pm
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

Re: RegExp Lazy Quantifiers

Posted: Mon Mar 30, 2015 10:27 pm
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