I wanna get all matches of string my regex about arount specific string.
Start with $t(' and end with '.
So, I use expression /(?<=\$t\(')(.*)(?=')/gi but it didn't work.
in this sentances I want get aaa.bbb, ccc.ddd, eee.fff, but it matched aaa.bbb, ccc.ddd', ['name', 'age and eee.fff
I wanna match end with first '. How can I use expression?
$t('aaa.bbb')
$t('ccc.ddd', ['name', 'age'])
$t('eee.fff', [
'name',
'age',
])
CodePudding user response:
You're looking for non-gready groups. (.*?)
/(?<=\$t\(')(.*?)(?=')/gi
