Regex To Match First Numbers In A String

A regular expression to match the first occurrence of a number in a string.

/^\d+/g

Matches:

  • 123Regex456
  • 1A2B3C
  • 123456

Non-matches:

  • Regex123
  • abcdef

See Also:

Regex Is Copied!