Using VSCode find/replace, how would I find all strings within a file conforming to the following, and replace all dashes in some-text-that-looks-like-this
with underscores?
text: some-text-that-looks-like-this
{text: some-text-that-looks-like-this}
text: some-text-that-looks-like-this, some other text....
All strings of "some-text-that-looks-like-this"
start with "some-text"
.
I do some regex and I can find all instances of some-text-that-looks-like-this
, i.e.
(some-text-.*)b
But have no clue how to replace '-'
with '_'
at running time.
alexseys is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
0
I do some regex and i can find all instances of some-text-that-looks-like-this, i.e.
(some-text-.*)b
After that, do CtrlShiftP -> Select All Occurences of Find Match
to select all matching words.
Then click Find in Selection
button (the button with three horizontal lines in the “find” popup).
Then just type -
in “find” and _
in “replace”, and click Replace All
.