正则表达式 - 获取字符串中的所有匹配项

I have a string like this:

$sContent = "t('Dashboard').' '.t('Settings Test').' '.t('My Test').' '.t('Other test')";

What I need is a regular expression that get each separate t('') values like:

t('Dashboard')
t('Settings Test')
...

In PHP I used:

$sRegExp = '/t\((.*)\)/i';
preg_match_all($sRegExp, $sContent, $aResults);

I get the same result with main string:

t('Dashboard').' '.t('Settings Test').' '.t('My Test').' '.t('Other test')

You can use:

$sRegExp = '/t\((.*?)\)/

or

$sRegExp = '/t\(([^\)]*)\)/

I'd try with explode function:

$sContent = "t('Dashboard').' '.t('Settings Test').' '.t('My Test').' '.t('Other test')";
$sContents = explode(".' '.", $sContent);

Well, let's assume that you never won't use ' inside that text. Then this should help.

preg_match_all('/t\(\'(?<=t\(\')([^\']*(?!=\'\)))\'\)/', $subject, $result, PREG_PATTERN_ORDER);
$result = $result[0];

Ok, if you want to use ' symbol, you must escape it with \, then try to use the following pattern

/t\(\'(?<=t\(\')(((?=\\\\)\\\\\'|[^\'])*(?!=\'\)))\'\)/