Requirement for regex for currency amounts

Hi there, I need to create a regex that applies  the follwing criteria
The amount begins with a £ symbol.
The amount either has no decimals, or just two, as in £9 or £9.11.
Commas appear every three digits to correctly separate thousands, millions, billions, etc., as in £4,444,666.89

LVL 11
SlimshaneeyAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ozoConnect With a Mentor Commented:
^£\d(1,3)(,\d{3})*(\.\d\d)?$
0
 
käµfm³d 👽Connect With a Mentor Commented:
I'm pretty sure ozo meant:

    ^£\d{1,3}(,\d{3})*(\.\d\d)?$                            <<===  curly braces around 1,3
0
 
ozoCommented:
Yes, that's what I meant
0
 
SlimshaneeyAuthor Commented:
Thanks for the help, thats exactly what Im looking for. Hope the points split is acceptable?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.