• Log in or sign up for an account here: https://www.sythe.org/login

I need to parse HTML for emails, but its not working right

asyk

Newcomer
Joined
Sep 1, 2009
Sythe Gold
0
Messages
2
I have a code, that searches for emails. But when I load in the source code with html and all the emails inside, It doesnt spit out all the emails. Can someone help or improve my code?

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim emailString As String = RichTextBox1.Text
        Dim emailRegEx As New Regex("""(\S+)@([^\.\s]+)(?:\.([^\.\s]+))+", RegexOptions.IgnoreCase)
        Dim m As Match = emailRegEx.Match(emailString)
        If m.Success Then
            Dim output As String = ""
            output &= "User name: " & m.Groups(1).Value & vbCrLf
           
            RichTextBox2.Text = output

        Else
            MsgBox("The e-mail address cannot be parsed.")
        End If

    End Sub
 
Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
Instead of using Regex, just use a simple function to get between two strings...So if the email is between let's say a <frame> tag and a <font> tag, then you could grab it and display it where you need to. If you search "GetBetweenAll" on Google you'll come across a few decent sources.
 
Runescape Gamblingrunescape gambling
Back
Top