Match decimal value

1
/\d+(\.\d+)?/
  • \d+ - match 1 or more digits
  • (\.\d+) - make a group of matches, match a . (dot) followed by 1 or more digits
  • ? - optional to match for the preceding token
Reference:

Match OR exact value

Let’s say want to match monthly or daily

1
/\bmonthly\b|\bdaily\b/

Wrap the word with \b, means the word has no other character in front or behind.

What if without \b? then it will matches

  • monthly
  • daily
  • foomonthly
  • monthlybar
  • foodaily
  • dailybar
Reference: