how to make regex below to detect also prices like just £7 not only everything > 9
/\d[\d\,\.]+/is
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.
to match a single digit, you can change it to
the
+means require one or more, so that’s why the whole thing won’t match just a7. The*is 0 or more, so an extra digit or,or.becomes optional.The longer answer might be more complicated. For example, in the book Regular Expression Cookbook, there is an excerpt: (remove the
^and$if you want it to match the2inapple $2 each) but note that when the number is 1000 or more, the,is needed. For example, the first regex won’t match1000.33(unsourced image from a book removed)