ricky_vancouver Posted December 13, 2010 Share Posted December 13, 2010 As in 6'2, I want to be find strings of the form: 6 6'2 6'22 (I suppose I'd like up to two decimal points) 6.2 (for those stubborn people who use odd punctuation) 6,2 (for those stubborn people who use odd punctuation) 6 2 (for those stubborn people who use odd punctuation) I have the following expresssion /^[1-9]?((.|,|\'|\s)([0-9]{1,2}))$/ However while it successfully matches the above it also matches 6666 666 66 Now I can see where perhaps three digits come from, though I'm not sure why it didn't demand something from the punctuation group, but I don't clueless as to how there could be 4 digits. Any help plucking out these faulty matches would be much appreciated! Link to comment https://forums.phpfreaks.com/topic/221473-matching-heights-debug/ Share on other sites More sharing options...
sasa Posted December 13, 2010 Share Posted December 13, 2010 you must escape . (dot) too /^[1-9]?((\.|,|\'|\s)([0-9]{1,2}))$/ Link to comment https://forums.phpfreaks.com/topic/221473-matching-heights-debug/#findComment-1146619 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.