visual studio - trying to use regular expression to surround my text with double quotes -
the following small scale example. how use search , replace (regular expression option) surround each line double quotes in visual studio 2012 search , 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 pretty confusing.
let's start. need surround text of each line quotes, leading spaces outside of quotes.
so need create first group catch leading whitespaces , tabs, , second 1 catch every word , space until end of line, , catch nothing if line empty.
then replace first group, quote char, second group, , quote char.
regex translation:
find: ([\t ]*)([\w ]+)
replace by: $1"$2"
Comments
Post a Comment