I need a javascript regex pattern to match a person's height to check if the input is valid. Here are some sample input:
5' 9"
6'
5'8"
Any ideas?
If you want to make sure that no one mucks around with it, you could limit it to sensible ranges, eg: 3' to 7'11''
/^(3-7)'(?:\s*(?:1[01]|0-9)(''|"))?$/
I always thought that the "inches" mark was a double quote ("), compared to VonC's answer where he put it as two single quotes (''), so this regex takes both into consideration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With