Hi
just wanted to let you know that a quantifier loses it's meaning whithin a character class. Like in your example you put the + inside a character class, which now means: [\s+] will match a whitespace (space or tab) or a +
//echo -a $regex(15++++++ mins,/(\d+)[\s+]*mins/)
--> 1
Also thanks to the S parameter, the input string is stripped from control codes, and
i makes the match case insensitive, so it could match on MINS or Mins ...
--> $regex($1-,/..../Si)
Depending on how the user will use this script, we could also make it react to decimal numbers like 15.5 mins etc.
--> (\d+(?:\.\d+)?)
Code:
if $regex($1-,/(\d+(?:\.\d+)?)\s*mins/Si) {
var %mins = $regml(1)
...
}
Greets
Last edited by FiberOPtics; 03/08/04 03:01 PM.