ChristopheC
15 years agoContributor
Suppression with Regular Expression
I have an XML file and I want to delete
everything that is between 2 tags including the tags.
<M_CODE>
<src>
...
</ SRC>
</ M_CODE>
I wanted to use the
Replace command but I can not use a regular expression
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Users\TestAdmin\Desktop\Essai.XML", 1)
strText = objFile.ReadAll
objFile.Close
RegExpr = "^<M_CODE>(.+)</M_CODE>$"
strNewText = Replace(strText, RegExpr, "")
Set objFile = objFSO.OpenTextFile("C:\Users\TestAdmin\Desktop\Essai.XML", 2)
objFile.WriteLine strNewText
objFile.Close
or
should I do otherwise?
everything that is between 2 tags including the tags.
<M_CODE>
<src>
...
</ SRC>
</ M_CODE>
I wanted to use the
Replace command but I can not use a regular expression
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Users\TestAdmin\Desktop\Essai.XML", 1)
strText = objFile.ReadAll
objFile.Close
RegExpr = "^<M_CODE>(.+)</M_CODE>$"
strNewText = Replace(strText, RegExpr, "")
Set objFile = objFSO.OpenTextFile("C:\Users\TestAdmin\Desktop\Essai.XML", 2)
objFile.WriteLine strNewText
objFile.Close
or
should I do otherwise?