I need a regex to match both, integer values aswell as float numbers (whereas float numbers have a “.” as seperator). Those numbers are always in a bracket and may have a leading “+”.
What should be valid:
- (1.0)
- (1)
- (9.9)
- (10000000)
- (+15)
What should be invalid:
- 1.0 — because no bracket
- 5 — because no bracket
- (1,5) — becaue “,” instead of “.”
- (a) — because of not a number
- (1 5) — because of not only one number
- (1+5) — because… well… just failing the pattern
- [5] — because wrong brackets
This should work on most perl like regex engines: