Try the following:
preg_match_all('/(?<=__\(").*?(?="\))/s', $foo, $matches); print_r($matches);
which means:
(?<=
EDIT
And as Greg said: someone not too familiar with the views may be more readable to leave them. Then you match everything: __(" , string and ") and complete the regular expression that matches the string,. .*? inside brackets to display only those characters. Then you will need to get your matches, although $matches[1] . Demonstration:
preg_match_all('/__\("(.*?)"\)/', $foo, $matches); print_r($matches[1]);
source share