Regex

Non capturing group

  • 8 cats
  • 9 dogs
  • 10 cows

Match and capture ONLY the number of cats and dogs using ?:, for non capturing groups

(\d+) (?:cats|dogs)