Here I have statements here my money in statement as MUR 30,000 or MUR 30000 or 30000 MUR or 30,000 MUR
Here I have one regex which works for MUR 30000 and MUR 30,000 but now I want regex for all this fours.
My Regex
/MUR d+(,d+)?/g
Here I have statements here my money in statement as MUR 30,000 or MUR 30000 or 30000 MUR or 30,000 MUR
Here I have one regex which works for MUR 30000 and MUR 30,000 but now I want regex for all this fours.
My Regex
/MUR d+(,d+)?/g
3
Answers
If I understood your request right, here is a regex to find all the variations:
I used
/gmx
flagsYou can use the following regex pattern:
(?:MURs)?: Match
non-capturing group, and the ? makes it optional
to 3 digits (?:,d{3})*: Matches groups of three digits preceded by a
comma, zero or more times
at the end
Try this
/(?P<currency1>MUR)?s?(?P<amount>d+,?d+)s?(?P<currency2>MUR)?/