The search & replace feature in VS Code cannot just search for static strings but accepts RegEx patterns. Just click on the .* icon in the search input to enable RegEx search.

For the replace pattern you can reference a RegEx group by using "$" and the index of the group. $0 references the entire match, $1 references the first group, $2 the second group and so on.

Let's make an example: The search pattern Hello (\S+) will find strings like "Hello John". The group (\S+) captures the name (here "John") which can be referenced in the replace pattern using $1. With the replace pattern Hi $1! we'll get the following results:

- Hello John
+ Hi John!

- Hello Jane
+ Hi Jane!