Regex To Match One Digit Number

A regular expression that allows you to match all one-digit numbers in a string.

/\b\d\b/g

Matches:

  • Regex 4 Pattern
  • Regex 4 Pattern 5
  • Regex 3 4 Pattern 5

Non-matches:

  • Regex 34 Pattern
  • Regex Pattern 345
  • 345 Regex Pattern

See Also: