So I have a random of strings and I need to parse them, let’s take an example:
This string - DeleteMe please and some other text
So I want to find DDeleteMe please and some other text and remove it, because all I need is This string
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.
So everything before the dash
-or how doesDeleteMe please and some other textqualifies to be deleted?If so, you need no regex, you can do it with
substrandstrpos:You could also use
explode():