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
>Solution :
You can use
Find: <span\s+translate>([^<>]+)<
Replace: <span>{{ $t("$1") }}<
See the regex demo.
Details:
<span\s+translate>– a<spanstring, one or more whitespaces and then atranslate>string([^<>]+)– Group 1 ($1refers to this group value): one or more chars other than<and><– a<char
The replacement is <span>{{ $t(" + Group 1 value + ") }}< text.
See the demo:
