mrQWERTY
mrQWERTY

Reputation: 4149

Regex to match any length number and decimal points at any position in the number

I want to match patterns like the following:

1.234 < x < 33.34
14123 <= x < 55656

Basically, I want to match any numerals no matter how long, and an optional decimal no matter where it is in the numerals. I feel like <,<= is easy enough. However, I cannot figure out how to match the numbers.

Here is my regex that only matches the signs and "x": (<=?)x(<=?)

Upvotes: 0

Views: 466

Answers (1)

mrQWERTY
mrQWERTY

Reputation: 4149

Never mind, I got the answer :

\d+(?:.\d+)?( <=? )x( <=? )\d+(?:.\d+)?

Upvotes: 1

Related Questions