What's the regex values for to match a string against all special characters and letters except a comma.
value = "23,$%aA";
I want to do a match if the value has any pf the special characters and letters like the above string then it will return true but if it just has a value like
value = "23,3456.00"
then it will return false. As all the special characters and letters are no longer part of the string.
Can I do this using match and regex.
Answer
This will match everything that is not numeric or not a comma or period (decimal point)
var result = str.replace(/[^0-9\.,]/g, "");
No comments:
Post a Comment