- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 05:24 AM - edited 08-23-2023 05:36 AM
Hi Everyone,
Need help in client script regex to allow only number form range 1 to 50000 in a single line text field.
Here is the regex I'm using and it is not working as expected. It allows till 50009. I want till 50000 only.
^(?:[1-9][0-9]?[0-9]?[0-9]?[0-9]?|1[1-5][0-9]?[0-9]?[0-9]?[0-9]?|2[0-4][0-9]?[0-9]?[0-9]?[0-9]?|25[0-5][0-9]?[0-9]?[0-9]?|6[0-4][0-9]?[0-9]?[0-9]?[0-9]?|50000)$
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 07:25 AM
This is working.
/^([1-9]|[1-9][0-9]|[1-9][0-9]{2}|[1-9][0-9]{3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65000)$/;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 05:43 AM - edited 08-23-2023 05:48 AM
Hi @Saai1 ,
please use the below regex code.
/^(?:[1-9]\d{0,4}|50000)$/
I hope this helps!
Regards,
Hemant
**Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.**
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 05:53 AM
Hello,
It is still allowing 50001 till 50009. I want till 50000 only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 06:13 AM
try the below code,
/^(?!5000[1-9]|[5-9]\d{4}|[1-9]\d{5,})\d{1,5}$|^50000$/
I hope this helps,
Thanks,
Hemant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 06:22 AM - edited 08-23-2023 06:29 AM
This works fine but it should not allow 0.
Also, I have one more requirement that should allow from 1 to 65000 numbers only.