I need to check if any strings follow the same format as these.
Val-Pak *Client Referral* Gift Certificate
It needs to be done in regular expression. I can’t find how to include the * and -.
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.
preg_grepfilters an array of strings and returns only those that contain one of the strings you mentioned. If you need to check only a single string, thenpreg_matchwill do.If you need to escape arbitrary strings for inclusion in a regex pattern, then
preg_quotecomes in handy.In any case, the asterisk,
*, is a special character in regular expressions and needs to be escaped with a\.