Find each line between quotation marks inside specific curly braces

I am working on a script, helping me catch all my localized strings in my project, and I'm stuck in RegEx.

On the next line, {{ translateAttr title="button.add_user.title" data-disable-with="button.add_user.disabled" }}I would like to catch "button.add_user.title" and "button.add_user.disabled" because my curly braces start with an attribute translateAttr.

So far I have come up with this rule \{{2}translateAttr .*=(['"])(.+?)(?=(?<!\\)\1)\1 ?}{2}, but as you can see here http://lumadis.be/regex/test_regex.php?id=2362 , it does not match all occurrences.

A little help here would be greatly appreciated.

EDIT: Patterns I would like the regular expression to also match

{{ translateAttr title="button with \"escaped quotes\" here" data-disable-with='button with single quotes' }}
{{ translateAttr title="want this with ' single quote" "but not this one" }}

EDIT2: Templates I Don't Like

{{ title="because no translateAttr" }}
{{ translateAttr "because no something= attribute before" }}

thank

+4
1

, PCRE (*SKIP)(*F)

^(?!.*?\{{2}\h*translateAttr).*(*SKIP)(*F)|=(["'])((?:\\\1|(?!\1).)*)\1

DEMO

+2

All Articles