Skip to content

Instantly share code, notes, and snippets.

@BumbuKhan
Created February 17, 2017 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BumbuKhan/122ac0d8c120fe87a738a0b38117e967 to your computer and use it in GitHub Desktop.
Save BumbuKhan/122ac0d8c120fe87a738a0b38117e967 to your computer and use it in GitHub Desktop.
How to replace Yii::t('app', 'lang-key') to tag's data attribute (in notepad++)
Finf what: > ?<\?= ?Yii::t\('app',\ '(.*)'\);? ?\?>
Replace with: data-lang-key="\1">
Example:
<a href="javascript:void(0)" class="weather" title="Precipitation"><?= Yii::t('app', 'weather');?></a>
will be raplced to
<a href="javascript:void(0)" class="weather" title="Precipitation" data-lang-key="weather"></a>
@BumbuKhan
Copy link
Author

Why should I replace with "\1"? #
Because regexp ("(.*)") that I've written has got the first index (from left to right)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment