I’m allowing a user to type in a width value that I need to ensure is a valid CSS width value.
Using regex, how would I get two matches from the user input where $matches[0] = a number value AND $matches[1] = either px or %?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First captured item will be the number, the second captured item will be px or %.