2

Hey Guys I want to get regex for numbers which are greater than 105 and above for all 3 digit number and they can be follow by 3 or 2 decimal like 105.1 ,109.11 like this.

I tried with

^\s*((105|\d{3,})\.\d+)\s*$

but no luck

Adriaan
  • 17,741
  • 7
  • 42
  • 75
Rohit W
  • 45
  • 7
  • So, the number should be from `105` to `999`? "follow by 3 or 2 decimal" - `109.123` is valid, isn't it? Leading/trailing whitespace is allowed, right? – Wiktor Stribiżew Sep 28 '22 at 09:39
  • 1
    [`^(?:10[5-9]|1[1-9][0-9]|[2-9][0-9]{2})(?:\.[0-9]{1,2})?$`](https://regex101.com/r/F58mCJ/1). **Edit:** Didn't notice the "3 or 2 decimals". This is for 1 or 2 decimals. Replace `{1,2}` with `{2,3}` (or `{1,3}` if you also want to support one decimal). – 41686d6564 stands w. Palestine Sep 28 '22 at 09:42
  • 2
    You can use some online tool like [regex-range.com](https://www.regex-range.com/) - I'd come up with something like [`^(?:10[5-9]|1[1-9]\d|[2-9]\d{2})(?:\.\d+)?$`](https://regex101.com/r/JiKMbk/1) using this for your requirements. – bobble bubble Sep 28 '22 at 09:44
  • Please do not roll back edits on your post that fix formatting issues. – Adriaan Sep 28 '22 at 13:24

0 Answers0