Home > database >  Regex expresion that should select matching text but escape everything between ><
Regex expresion that should select matching text but escape everything between ><

Time:10-19

I have a lot of files where i have something similar

<span translate>textTo.translate</span>

What need to look like is

<span>{{ $t("textTo.translate") }}</span>

What i do now is find all occurrences of span translate> and replace all with span>{{ $t(" and then go thru file and finish step by step

Is there any regex that i could use in replace all to achieve this?

What i managed to do is to select all (span translate>)[^<>] (?=<) but i cannot find replacement regex

CodePudding user response:

You can use

Find: <span\s translate>([^<>] )<
Replace: <span>{{ $t("$1") }}<

See the enter image description here

CodePudding user response:

nvm, found answer but for some reason works only in VSCode while fails in PHPStorm.

select regex span translate>([^<>] (?=))< replacement regex span>{{ $t("$1") }}<

  • Related