skip to Main Content

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


  1. If I understood your request right, here is a regex to find all the variations:

    b(?:MURs?d{1,3}(?:,d{3})*|MURs?d+|d{1,3}(?:,d{3})*s?MUR|d+s?MUR)b
    

    I used /gmx flags

    Login or Signup to reply.
  2. You can use the following regex pattern:

    /(?:MURs)?d{1,3}(?:,d{3})*(?:sMUR)?/g
    

    (?:MURs)?: Match

    • es "MUR " if it appears at the beginning. The (?: … ) is a
      non-capturing group, and the ? makes it optional
    • d{1,3}: Matches 1
      to 3 digits (?:,d{3})*: Matches groups of three digits preceded by a
      comma, zero or more times
    • (?:sMUR)?: Matches " MUR" if it appears
      at the end
    Login or Signup to reply.
  3. Try this

    /(?P<currency1>MUR)?s?(?P<amount>d+,?d+)s?(?P<currency2>MUR)?/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search