- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2021 11:52 PM
Hi all,
Can anyone help with the regular expression for the variable in catalog item. The format should starts with '$0.00'. means it should start with $ and numerical values.00
examples are $118.09,$6.08,$3456.52,$12344.17
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2021 02:54 AM
var regex = /^\$(?![.0]*$)\d+\.\d{2}$/;
Hope it helps!
Please mark helpful or correct if applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2021 12:00 AM
Hi
/([$])([\d,.]*)/g
should do the job.
You can try it here: https://regex101.com/r/nK0jK7/1
Kind regards
Maik
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2021 12:14 AM
Hi
This regex worked for me
var regex = /^\$( )*\d*(.\d{1,2})?$/;
Found it from : https://regexlib.com/Search.aspx?k=currency
Hope it helps!
Please mark helpful or correct if applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2021 12:28 AM
Thanks for the reply, I tried its partially working. I am able to put '$134' or '$134.1' but i am looking for the format with '$134.05'. It must be 2 digits after the '.'
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2021 02:54 AM
var regex = /^\$(?![.0]*$)\d+\.\d{2}$/;
Hope it helps!
Please mark helpful or correct if applicable.