Hi Guys,
Once my application downloads emails i feed the raw message via pop through to a function:
Within the message is the same url 3 times but displaying different pages on the site, is there a way to only match 1 of the urls? the function is called in a for loop:
I am also looking toextract the username/password from the email which looks like:
username: graham23s
password: pass123
Is it possible to do all 3 regex matches in the same regex command or would it be 2/3 seperate ones?
thanks for any help guys! i am absolutely pants at regex lol
Graham
Once my application downloads emails i feed the raw message via pop through to a function:
Code:
Function getMessageInfo(ByVal inputMessage As String) As String
Dim regex As New Regex("http://([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?", RegexOptions.IgnoreCase)
Dim matches As MatchCollection = regex.Matches(inputMessage)
For Each match As Match In matches
MessageBox.Show(matches(0).ToString)
Next
End FunctionCode:
For I = 1 To CInt(server_Stat(1))
If StopDownload Then
StopDownload = False
Exit For
End If
Application.DoEvents()
ProgressBar1.PerformStep()
WriteBuffer = enc.GetBytes("RETR " & I.ToString & vbCrLf)
Dim Message As String = ""
If (chkSSL.Checked) Then
mySSLStream.Write(WriteBuffer, 0, WriteBuffer.Length)
myStrReader.ReadLine()
Else
myNetStream.Write(WriteBuffer, 0, WriteBuffer.Length)
myStrReader.ReadLine()
End If
Do While myStrReader.Peek <> -1
Message += myStrReader.ReadLine & vbCrLf
Loop
Dim credentialsExtracted As String = getMessageInfo(Message)
Next Iusername: graham23s
password: pass123
Is it possible to do all 3 regex matches in the same regex command or would it be 2/3 seperate ones?
thanks for any help guys! i am absolutely pants at regex lol
Graham