views:

19

answers:

1

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.

A: 

According to this tutorial, both : and ! are reserved words. Did you try escaping them?. Also you might consider increasing your accept rate...

npinti
What do you mean accept rate?So I would make the pattern something like this Dim p = "\:\(?<ircnick>.*?)\!\"If I am incorrect please correct me.
xZerox
Yeah something like that should do the trick. Also, with respect to the accept rate, when you ask a question on stackoverflow and people provide a solution to your question, you can mark the solution provided as correct. If you do so, people on stackoverflow are most likely to respond
npinti
With what I posted it gives me this errorparsing "\:\(?<info>?)\!\" - To many )'s
xZerox
Nevermind I figured this out! I put 2 escapes not 1 :D.
xZerox