Regular Expressions 101

Translatable string matcher for Laravel

Open Workspace
  • PCRE (Legacy)
  • Match
0

Regular Expression

/
[^\w](?<!->)(trans|trans_choice|Lang::get|Lang::choice|Lang::trans|Lang::transChoice|@lang|@choice|__)\s*\(\s*((?<![\\])['"])((?:.(?!(?<![\\])\2))*.?)\2\s*[,\)]
/
g

Description

When searching translatable strings in Laravel, this Regex will match all quoted string labels and JSON message localizations.

Submitted by Anonymous