Reputation: 239
I am trying to figure out a regular expression that matches a . (period). I looked for a formula but there was no formula that matches period.
12903,03930.
Upvotes: 20
Views: 70289
Reputation: 16656
You just need to escape the . as it's normally a meta character. The escape character is a backslash:
\.
E.g:
/[0-9]+\./
Will match a number followed by a period.
If you wanted to match the entire number except the period, you could do this:
/([0-9,]+)/
Here we use the range operator to select all numbers or a comma, 1 or more times.
Upvotes: 32