REGEX NON MATCHING - LINES NOT CONTAINING STRING LOGIC

REGEX NON MATCHING - LINES NOT CONTAINING STRING LOGIC

Post by jaso » Mon, 27 Oct 2003 00:47:06


The following vb code displays every line that has a particular string
in it. How do I list every line that does not have that string. "!"
does not seem to work for me and not sure where to place it in match
logic.


<vb code>

readin("linetest.txt")
dim linex as string
linex="line"

Dim xxx as string
xxx = "^(.+)"+linex+"(.+)$"
Dim regexp2 as Regex = new Regex (xxx, RegexOptions.IgnoreCase or
RegexOptions.Multiline )


Dim objMatch as Match
dim z as string
For Each objMatch in regexp2.Matches(session("readin"))
z = objMatch.ToString()
response.write(z + "<br>")
Next

</vb code>

Thanks in advance for any help or info.
 
 
 

REGEX NON MATCHING - LINES NOT CONTAINING STRING LOGIC

Post by Craig Deel » Mon, 27 Oct 2003 01:08:30


The caret ^ is usually used inside a char grouping to specify 'all chars
but these'....check out regexlib.com, here's there cheat sheet:

http://www.yqcomputer.com/

a very good site where you can even test your expression...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET