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

Discussion in 'Programming General' started by asyk, Sep 1, 2009.

I need to parse HTML for emails, but its not working right
  1. Unread #1 - Sep 1, 2009 at 9:18 PM
  2. asyk
    Joined:
    Sep 1, 2009
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0

    asyk Newcomer

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

    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
     
  3. Unread #2 - Sep 7, 2009 at 5:36 PM
  4. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

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

    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.
     
< SandBrowser, a basic Web Browsing Application! | Java won't work on linux for me >

Users viewing this thread
1 guest


 
 
Adblock breaks this site