Hi Chaps,
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?
Hi Chaps,
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?
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.
@Bart I got it totally wrong. I was trying to match prices like 10,256,543.45 (but failed).
OP wanted just 10256543,45