Can anyone help me with finding regular expression for the below
$string = "id=A12dk9-mds&name=4950";
I need to find regular expression to find a dynamic value (A12dk9-mds in this example).
i.e the dynamic content between = and &
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.
A simple regex can be used for that.
Explanation:
id=matches id=([^&]*)matches anything but the & symbol as much as possible and returns that&matches the &As long as you know they will always be between a
=and a&this will work.PHP Code: