I am having a tricky time getting this regular expression to work. The pattern I have so far is:
var dollarPattern = /^\d{1,}|\s\d/gi;
var matchedResults = new Array();
matchedResults = textValue.match(dollarPattern);
What I am hoping to achieve is using the example string "2 to 2.99 (63 items)", I want to check if it either starts with a digit, or if it contains a blankspace followed by a digit (in this case, both conditions are true). However, I keep getting a "matchedResults is null" error in Firefox (although it should have a length of 2).
Any ideas what I am doing wrong? Thanks...
{1,}is equivalent to+. That makes it a bit shorter and more readable.