Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
^(-\d+|\d+,?)*\.\d+(e\d+)?|\d+$
"
gm

Description

A simple regex to capture different formats of decimal numbers.

Note: the last string "720p" I have skipped it. My regex will not take that last string into account. This is just an exercise from https://regexone.com/problem/matching_decimal_numbers

Submitted by xaeroborg - 7 years ago