So, I'm trying to do a Find and Replace in notepad++ with regular expressions, because I have a 'Find' string that can have any number of characters between 2 quotes. Here is a sample of my data.
<myVar Variable="MY-VAR" Type="string"/>
<myOtherVar Variable="MYOTHERVAR" Type="int"/>
<finalVar Variable="FVAR" Type="string"/>
So, I want to match ' Variable="[everything inside the quotes]" T
' and replace it with ' field="" t
'.
I don't want to save what's in the quotes. The ultimate goal is to have lines that looks like this:
<myVar field="" type="string"/>
<myOtherVar field="" type="int"/>
<finalVar field="" type="string"/>
I think this has been my best attempt so far in the Find box, but ya'll can tell me if not. XD
/' variable="(\w+)" t'/
Thanks all!
Don't know the notepad++ regex syntax, but following idea should work:
try to replace
Variable="[^"]*"\s+T
with
field="" t
EDIT
I don't have windows machine, just installed notepad++ in a virtual box, and did a small test :)
the result looks like this:
With Notepad++ your RegEx will be:
Variable=".*"
Don't forget the last SPACE it's important. Replace it with
field=""
also containing a space as last character.
Greets
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.