Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74793

Regular expression restrictions

$
0
0

I am new to regular expressions. I have a text field and I need to limit the input to numbers and one comma. I know how to limit to numbers. But I have another condition. If the user enters a comma, they must enter another number after that. There is no restriction on the number of digits. There can only be one comma. The following are all valid inputs: 123456 4567,8907

but I can't allow 4567,. I have this pattern, pattern="[0-9]+([,][0-9]+)?" but it's not working.


Viewing all articles
Browse latest Browse all 74793

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>