I have the following set of strings in a PHP file.
echo '<div class="alert"><b>',__('ERROR!'),'</b> ',__('Please fix following errors!'),'</div>';
echo sprintf(__('hello %s'), $name);
___('Hello');
__() function returns string and ___() function echo's a string. I have written a regex to grab text in between __('') or ___('') but it's not working properly.
Here is my regex
if(preg_match_all("#(__{2,3}(\((.*)\),|;))#",$text, $matches))
and output I get is:
__('ERROR!'),' ',__('Please fix following errors!'), (Incorrect result)
__('hello %s'),
For the ___() function I am using quantifier _{2,3} but it's not picking up this function. How do I get the string only from the functions?