I have a string that is
$str = "testingSUB1";
How can I strip out SUB* from the string? I assume using preg_replace but I’m not good with matching what I want with regex.
Does anyone know how I can do this?
Thank you
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.
That’s the way.
The
#s are delimiters; they can be any non-alphanumeric/whitespace/backslash character that doesn’t appear in the pattern.[0-9]means any digit (you can use\dtoo in some languages, but I usually don’t bother), and the+means one or more of the previous, so if you take the+out it will only replace the first digit