I have a string, such as this:
$foo = 'Hello __("How are you") I am __("very good thank you")'
I know it’s a strange string, but stay with me please 😛
I need a regex expression that will look for the content between __(“Look for content here”)
and put it in an array.
i.e. the regular expression would find “How are you” and “very good thank you”.
Try this:
which means:
EDIT
And as Greg mentioned: someone not too familiar with look-arounds, it might be more readable to leave them out. You then match everything:
__(", the string and")and wrap the regex that matches the string,.*?, inside parenthesis to capture only those characters. You will then need to get your matches though$matches[1]. A demo: