Regular Expressions 101

Numbers except integers starting with zero

Open Workspace
  • Python
  • Match
0

Regular Expression

r"
^(?!(^0\d).)^\d*\.?\d+$
"
gm

Description

matches:

  • 1234
  • .0123
  • 0.123

no matches:

  • 01234
  • 01.234
Submitted by Anonymous