Home > front end >  Renaming attributes result using sequential values
Renaming attributes result using sequential values

Time:10-05

I'm facing a challenge with SVG attributes results. I need to rename several of the results of the SVG attribute in a sequential form.

xlink:hreef-"#path-1"
xlink:hreef-"#path-2"
xlink:hreef-"#path-3"
...

How can I automatize it? Exist a plugin or extension of VSCode that can help me?

Thanks in advance!

Alves, Luiz.

CodePudding user response:

You can do that with this extension I wrote: find-and-transform demo with matchIndex

CodePudding user response:

You can use the extension Regex Text Generator

Find and select all the items you want to rename

Find xlink:hreef

The Select > Select All Occurrences

Now move the multi cursors and select the part you need to replace.

Then issue command: Generate text based on Regular Expression

For the generator expression use: {{=i 1}} if you want the numbering start at 1.

You get a preview of what the result is.

  • Related