I’m struggling to create a regex expresion in Javascript to match values between 5pt and 30pt.
That is 5pt, 6pt, 7pt, …, 29pt and 30pt. The value should have a number between 5 and 30 followed by pt.
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.
This will match anything from 5-30 and will not match things like 35pt. So far in the above regexes provided, only Andrew’s method avoids false positives like matching “35pt” as “5pt”.
where your match is in the first backreference. Note the importance of screening for things like other numbers before.
If you’re indifferent to false positives like that, try
where the entire match is what you’re looking for.