A
A
Alex Goncharov2018-11-27 16:53:44
Regular Expressions
Alex Goncharov, 2018-11-27 16:53:44

How to use regex replacement in Sublime Text or VSCode?

I have a folder with html files. How to find a specific div with a class and replace its content in all files?

<div class="header-info-box">
 Разный контент, <span> включая теги</span>
</div>

In all files, only the contents of a specific div with the class name header-info-box need to be replaced
How do I use a regular expression to search and replace?
My expression:
find div
(<div class="header-info-box">).+(</div>)
Replace its contents:
$1<div class="hello"></div>$2
https://regexr.com/43s07

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-11-29
@dodo512

For Sublime Text or Notepad++.
find:
Replace:
https://regex101.com/r/ibeyIw/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question