How to replace a modify text globally in tree using Visual Studio Code

Viewed 25

I'm working on SEO on dad's website. I have many files divided in to destination, underdestination etc.

For example i have these alt tags:

 alt="Kefalonia - Skala 1" /></a
 alt="Kefalonia - Skala 2" /></a
 alt="Kefalonia - Skala 3" /></a
 alt="Kefalonia - Skala 4" /></a

Word skala is always different each file. Word Kefalonia is same in all files in destination called Kefalonia.

As you can see it ends by closing a tag I need insert it front of closing a tag new title with this structure: Skala (number 1-4) some text.

ATM i'm im using CTRL+D and edit it file by file for example like this

  1. move closing a tag on new line
  2. copy alt for new line
  3. rename new alt to title etc.. It's long and boring.

I thing there must be smarter way to do that. I've found CTRL+SHIFT+H where i can replace some text globaly in whole tree. I just i don't know how to use it for my case.

Simply i need this. Where word Skala is always different each file.

Easy image what i need

Easy image what i need

1 Answers

Use the Search Bar Ctrl+Shift+F

  • search regex for alt="Kefalonia - (\w+) (\d+)" /></a
  • replace with: alt="Kefalonia - $1 $2"\n\ttitle="$1 - Some text $2" /></a
Related