Regular Expressions 101

Community Library Entry

2

Regular Expression
Java 8

"
^\d*\s*[!<>=](?>\=)?\s*\d+$|^\d*\s*<>\d+
"
gm

Description

Regex expression for comparing decimal numbers with the usual comparison operators such as < (less than), <= (less than or equal to), > (greater than), >= (greater than or equal to), != (not equal to), == (equal to), ...

The regex also allows filtering of data from e.g. a database, whereby the first value is not needed, e.g. [FIELD] < 100

Submitted by Florian Drees - 4 years ago