Regex To Match First Numbers In A String

Category: Numbers

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:

Rate This Regex
Sending
User Review
0 (0 votes)

Expression Flags

Flags Description
i Ignore case sensitive.
g Allows global search.
m Allows multiline search.