Regular Expression To Get All Numbers From A String

A regular expression to match all numbers found within a string.

/(\d+)/g

Matches:

  • RegexPattern123
  • 123RegexPattern
  • 123

Non-matches:

  • RegexPattern
  • !@#$%

See Also: