VB.net Regex Get Information

Posted by xzerox on Stack Overflow See other posts from Stack Overflow or by xzerox
Published on 2010-05-31T22:31:38Z Indexed on 2010/05/31 22:53 UTC
Read the original article Hit count: 360

Filed under:
|
|
|
|

Well I am currently trying to get the word/text in between these 2 things

: and !

I tried this

        Dim nick As String = String.Empty
        Dim p = ":(?<ircnick>.*?)!"
        Dim Matches = Regex.Matches(mail, p, RegexOptions.IgnoreCase Or RegexOptions.Singleline)
        If Matches IsNot Nothing AndAlso Matches.Count > 0 Then
            For Each Match As Match In Matches
                If Match.Groups("info").Success Then
                    nick = (Match.Groups("ircnick").Value)
                End If
            Next
        End If

It doesn't display anything. If you guys can fix this code for me I would be happy :D.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about vb.net