- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 09:13 AM
Hi,
How to validate a field which should accept only numbers with separators or decimals.
Eg: it should be like 0,00 or 0.00
Can someone help in the validation regex for this requirement.
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 12:24 AM - edited 03-16-2023 12:26 AM
@Buddy 1 ,
Try this and let me know:
/^[0-9]{1}[,.][0-9]{2}$/
Tried and tested for many use cases and seems it worked for me.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 09:56 AM - edited 03-15-2023 09:59 AM
Can you try this:
/^[0]+([,.][0]{2})?$/
I have tested it works for me, please check and let me know if you have any issue:
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 11:57 PM
Hi @Prince Arora ,
The example format is 0,00 or 0.00 but it can be also 1,12 or 2.13 .
Note: It can accept numbers.but the format is before separator or decimal allow only one digit and after separator or decimal allow only two digits
Can you suggest?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 12:24 AM - edited 03-16-2023 12:26 AM
@Buddy 1 ,
Try this and let me know:
/^[0-9]{1}[,.][0-9]{2}$/
Tried and tested for many use cases and seems it worked for me.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.