c# - VB.NET - Regular Expression to search a partcular format of Tag -
e.g have tags "<abc_start>"
, "<abc_end>"
in text file . need read tags , between contents rest of lines should ignore.how check read line has tag using regular expression. please me form reg expression
my text file this comment ignored text file this comment ignored
<abc_start> ipconfig/all <abc_end>
this comment part not considered.
i have read each line of text file , further processing of commands exists in between tags. need validate abc_start
tag using regular expression , strings till reaches end tag.
depending on request following code should work you:
dim regex regex = new regex("<.*?_start>(.*?)<.*?_end>", regexoptions.multiline or regexoptions.singleline or regexoptions.ignorecase) dim txtfilecontent string = "textextextextext<abc_start>ipconfig/all<abc_end>textextextextextex<def_start>ipconfig/none<def_end>textextextextextex" dim collection = regex.matches(txtfilecontent) each m match in collection dim commpart string= m.groups(1).value msgbox(commpart) next
Comments
Post a Comment