Reputation: 723
In my html page I have a lot of strings inside tags. like
<p>Some string 1</p>
<p>Some string 2</p>
<p>Any string 3</p>
I need to put all of them to attribute TRANSLATE, lowercase them and replace all spaces to underscores inside strings.
So I multiselect all of them with holded CTRL, then ctrl+K, ctrl+L make them lowercase, CTRL+x - erase, two left arrows for going inside tags, write translate="PASTE HERE"
Now I have
<p translate="some string 1"></p>
<p translate="some string 2"></p>
<p translate="any string 3"></p>
Next step - I need to make underscores instead of spaces.
To find all translate strings I use regex (?s)translate=".+?" But how to replace? Help.
Upvotes: 0
Views: 2446
Reputation: 5242
This is simple but will work and faster than looking for a smarter answer.
Find this: translate="(.*) (.*)"
Replace with this: translate="\1_\2"
Keep using Replace All
until all your unwanted spaces are underscores (in the example you gave, twice).
Upvotes: 0
Reputation: 3535
Type ctrl + H
and then
Use negative-lookbehind to search spaces which are not preceded by p
.
(?<!p)\h+
\h
matches only horizontal spaces.
Now replace-all
it with _
.
Upvotes: 2