Jump to content

Recommended Posts

Posted

 

 

Would anyone have a regex expression for currency field. I have the one below for number and decimal but want to add a currency sign

 

^((?=.*[1-9]|0)(?:\d{1,5}))((?=.*\d)(?:\.\d{3})?)*((?=.*\d)(?:\,\d\d){1}?){0,1}$

Posted

What currency?

Just inserting a £ between the initial caret and the first bracket works for UK, other currrency symbols may need escaping, though.
I think what you have uses the opposite to UK format, too (it needs a thousand separator of period, and pence delimiter of comma)- just checking that this is what you need?

Posted

Just a slight modification on the ones provided by hornbill, if you are not aware these are in the form designer, then clicking the ? next to the regex validation 

^[£]]?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$

 

image.png.324628343091bcb0185a0f1647652f2d.png

Posted
On 11/07/2024 at 12:54, Jim said:

Just a slight modification on the ones provided by hornbill, if you are not aware these are in the form designer, then clicking the ? next to the regex validation 

^[£]]?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$

 

image.png.324628343091bcb0185a0f1647652f2d.png

*Gasp*

When was that Regex Selector introduced!?

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...