The following is just a small scale example. How do I use search and replace (regular expression option) to surround each line with double quotes in Visual Studio 2012 search and replace?
List Item
Item 1
Item 2
End List Item
"List Item"
"Item 1"
"Item 2"
"End List Item"
I agree, VS find & replace regexes are pretty confusing.
Let's start. We need to surround the text of each line with quotes, with leading spaces outside of the quotes.
So we need to create a first group that will catch the leading whitespaces and tabs, and a second one that will catch every word and space until the end of the line, and that will catch nothing if the line is empty.
Then we will replace by the first group, the quote char, the second group, and another quote char.
Regex translation:
Find: ([\t ]*)([\w ]+)
Replace by: $1"$2"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With