Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
[-]?\d+(?:[.]?\d+)?(?:[Ee]?[-]?\d+)?
"
gm

Description

parses a json digit such as:

1, 1.0, -1, -1.0, -1.0E-1, etc..

rejects digits such as:

1., 1.E, 1E, 1.0-E1, etc..

Submitted by Mass - 3 years ago