Community Patterns

Community Library Entry

-2

Regular Expression
Created·2015-07-21 21:28
Flavor·PCRE (Legacy)

/
# https://regex101.com/r/fP1oQ6/2 (?(DEFINE)# (?<W>\s*) (?<V>\d+(?:\.\d+)?(?&W)) (?<S>[-+]?) (?<O>(?&W)[-+*\/](?&W)) (?<E>(?&S)(?:(?&V)|\((?&W)(?&E)(?&W)\))(?:(?&O)(?&E))?)# )# ((?&E))
/
xgJ
Open regex in editor

Description

ValidatesMathematical Expressions. Ignores whitespace. Includes parenthesis matching.

Submitted by Jeremy Friesen