Regular Expressions 101

Community Patterns

Replace text domain in WP i18n


Regular Expression
PCRE (PHP <7.3)

__\(\s?((['"])(((?!(?<!\\)\2).)*)\2), 'wprss'\s?\)


This will find all instances where the WP i18n function __() is used, and change the text domain to something else. This will recognize instances of the function use as separate, even if they appear in the same function

Submitted by Xedin Unknown - 10 years ago