I have written this regex to match translation strings. Everything works fine except it only matches single quotations ''
in strings, although I've written several rules to match both single and double quotations.
Here is my regex rule:
(Yii::t\()(\'|\")(.*?)(\'|\")\,(\'|\")(.*?)(\'|\")\)
as expected (\'|\")
should match both ones but it doesn't.
I have also tried the following rules as well:
('|")
(['"])
Examples:
successfully matches these:
Yii::t('backend','My Profile')
Yii::t('backend','Log Out')
does not match these:
Yii::t("backend", "Search...")
Yii::t("backend", 'Sounds')
code i'm using to for matching regex:
re := regexp.MustCompile(`(Yii::t\()(\'|\")(.*?)(\'|\")\,(\'|\")(.*?)(\'|\")\)`)
matches := re.FindAllString(line, -1)
Update: The problem was because some strings contained white spaces (not because of quotations).