Click to See Complete Forum and Search --> : ecannizzo


ecannizzo
May 15th, 2001, 02:08 PM
I am using the webbrowser control and getting the innertext back. I then need to go through it and extract all the email addresses in the document. I am looking for the @ symbol, and I can get everything from that on, but i can't figure out how to get everything before it and have it cut of at a space or a new line. Any suggestions?

Thanks!
Erica

coolbiz
May 15th, 2001, 03:44 PM
Check out the code below to move the index backward till a space is found. Of course you have to modify it to work with your code.


Sub MoveBack(szHTML as string)
dim nStartInd as Long
dim bExit as Boolean
dim szCurChar as string

' look for the @ sign
nStartInd = InStr(1, szHTML, "@")

' loop as long as nStartInd > 0 (begin of string)
bExit = false
while ((nStartInd > 0) and (not bExit))
if (nStartInd - 1) = 0) then
' we are at the beginning of the line
bExit = true
else
' move back
szCurChar = mid$(szHTML, nStartInd - 1, 1)
if (szCurChar = " ") then
' exit
bExit = true
else
' move back 1 step
nStartInd = nStartInd - 1
end if
end if
wend
End Sub




Of course, I have not really tested the code but the idea is there. Someone might be able to come up with better solution :)

-Cool Bizs

ecannizzo
May 15th, 2001, 03:58 PM
It doesn't exactly work, but I think if I play with it enough I might be able to get what I want out of it.

Thanks,
Erica

coolbiz
May 15th, 2001, 05:01 PM
Yea .. work on it and if you still stuck, please don't hesistate to either post another message or email me personally.

-Cool Bizs