RegEx for Prices?

regex

Solution

In what language are you going to use it?

It should be something like:

^\d+(,\d{1,2})?$

Explaination:

X number in front is: `^\d+` where `^` means the start of the string, `\d` means a digit and `+` means one or more

We use group `()` with a question mark, a `?` means: match what is inside the group one or no times.

inside the group there is `,\d{1,2}`, the `,` is the comma you wrote, `\d` is still a digit `{1,2}` means match the previous digit one or two times.

The final `$` matches the end of the string.

Problem

I am searching for a RegEx for prices. So it should be X numbers in front, than a "," and at the end 2 numbers max. Can someone support me and post it please?

Original source

Related problems