I want to store the word before the second comma in a string.
So if the string looks like this: Hello, my name is David, bla bla.
I want to set a variable $test = David
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.
^— The beginning of the string/line[^ ]— Any character not being …,— … a comma*— Zero or more of the preceding,— A comma[^,]*— Again, any character not being a comma, repeated zero or more times\b— A word boundary (zero width)( )— A capturing group\w— Any word character+— One or more of the preceding\b— A word boundary (zero width),— A comma