Reputation: 1770
This question is about Visual Studio Code search box.
I want to replace all the "spaces" by the character "_" inside the my substring with spaces
of mystring
for example:
-> From
{
"Show_details": mystring("my substring with spaces"),
"Type_of_event": mystring("my substring with spaces2"),
}
-> To
{
"Show_details": mystring("my_substring_with_spaces"),
"Type_of_event": mystring("my_substring_with_spaces2"),
}
Search: mystring\("([a-z]*?( )[a-z]*?)"\)
Upvotes: 2
Views: 193
Reputation: 627082
You can use
(?<=mystring\("[^"]*)\s+(?=[^"]*"\))
Details
(?<=mystring\("[^"]*)
- immediately to the left, there must be mystring("
and then 0 or more chars other than "
\s+
- one or more whitespaces (remove +
if two consecutive spaces must be converted to two consecutive _
s)(?=[^"]*"\))
- immediately to the right, there must be 0 or more chars other than "
and then ")
.See the screenshot:
Upvotes: 2