Regular Expressions 101

Sponsors

Community Patterns

Community Library Entry

0

Regular Expression
Created·2019-08-22 12:56
Flavor·PCRE (Legacy)

/
(__|_e)\(\s?(('|")(((?!(?<!\\)\3).)*)\3)(\s?|\s?(,\s?(''|""))?)\)
/
gm
Open regex in editor

Description

In a WordPress project, when you miss the text domain in i18n functions, the strings will not be translated. With this regex you can check if the i18n functions __() and _e() have their text domain, and eventually use the substitution provided for adding it.

Submitted by anonymous