Forums Register Login

regex in java

+Pie Number of slices to send: Send
Hi, I'm using regex API in Java 5. May I ask how I would for a pattern like 5'11" or 6'0" for validating height field? Thanks!
+Pie Number of slices to send: Send
What about "[0-9]'[0-9][0-1]?\""
I don't know this metric system so I don't know the actual requirements...
+Pie Number of slices to send: Send
 

Originally posted by Timothy Sam:
Hi, I'm using regex API in Java 5. May I ask how I would for a pattern like 5'11" or 6'0" for validating height field? Thanks!



Though using regex to partially validate stuff is a good idea, you can't completely validate that sort of field with it. In particular you won't be able to catch such things like the inches value being greater than 11, for example.
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 498 times.
Similar Threads
regular expression
Pattern with wildcards
How to fetch only numbers from string
[regex help]Find EXACT characters in a String.
How to regex made up of numbers surrounded by alphabets & special chars
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 09:33:52.