Hi. I need someones help please. I'm a complete newb to regular expressions, and can't figure this out.
I need it to be able to tell if a str is a price or not. Examples:
"$23.34" = true
"£23.34" = true
"€23.34" = true
"€23213213" = true
"€23.366" = false
"€23.3" = false
"366" = false
"€.366" = false
This is what I've done, but it doesn't work. It just returns false all the time.
5 USD for whoever makes it work, through paypal
post it on this thread please.
Thanks very much in advance.
I need it to be able to tell if a str is a price or not. Examples:
"$23.34" = true
"£23.34" = true
"€23.34" = true
"€23213213" = true
"€23.366" = false
"€23.3" = false
"366" = false
"€.366" = false
This is what I've done, but it doesn't work. It just returns false all the time.
Code:
function isPrice($str){
return(!preg_match("/^(£|$|€)[0-9](\.[0-9]{2})?/", $str)) ? FALSE : TRUE;
}
5 USD for whoever makes it work, through paypal
post it on this thread please.
Thanks very much in advance.







