Jump to content

Regular Expression


Go to solution Solved by IPCommerceFan,

Recommended Posts

Hello 
I am trying to insert a Regular Expression in a text filed that will check the value inserted by user and will validate the following:

  • Only numbers allowed
  • only 1 dot allowed
  • minimum value is 1.4

Can you please help me with the expression?

Many thanks 🙏

image.png.6021230b8eb51cdbe8b8199b74d45064.png
 

Edited by livegames.co.il
Link to comment
Share on other sites

8 minutes ago, IPCommerceFan said:

Glad you figured it out!

I'm going to post this here anyway, in case someone stumbles on this thread while searching for similar:

^([1-9]\.[4-9]{1}|[2-9]{0,9}\.[0-9]{1}|[0-9]{2,9}\.[0-9]{1})$

https://regex101.com/r/iqeDII/3

Thank you, @IPCommerceFan


this is what I have done -  i thought i figure it out 😌
/^([1-9].?[4-9]|[2-9](.?[0-9])?)$/
But actually, I am struggling to do the minimum of 1.40; 
because now its accept minimum of 1.4 but reject 1.40
if you can help me, I would appreciate it.

Edited by livegames.co.il
Link to comment
Share on other sites

Updated!

https://regex101.com/r/iqeDII/6

^([1-9]\.([4-9]{1}|[4-9]{1}[0-9])|[2-9]{0,9}\.[0-9]{1}|[0-9]{2,9}\.[0-9]{1,2}|[2-9]{0,9})$

My understanding was that you only wanted to use 1 decimal place (only 1 dot allowed), which is why the original pattern didn't account for 1.40.

How many decimal places should be accounted for?

Edited by IPCommerceFan
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...