I am having an array of strings.
(102) Name3
How can I match for strings starting with (####) and get the Name part of the line easily.
I am trying the following which is not working.
if(preg_match("/(d+)/", $myArray[$i], $matches))
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.
You need to escape the parentheses that are in the expected input string:
That’s the following regular expression:
/Start of regex (this can be any character, but is usually a /)\(the character ((begin capturing group 1\dany digit+previous match, 1 or more times)end capturing group 1a space(begin capturing group 2.almost any character+previous match, 1 or more times)end capturing group 2$end of string/End of regex (must match first character)You can find more descriptive definitions on regular-expressions.info.
With the above, matches will contain for example: