Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clean a txt or html code with vbs

Status
Not open for further replies.

Yli

Technical User
Sep 22, 2009
11
ES
hi all i need help with vbs. i don't have any ideea about coding.
the script must to the next
- function to search email address in txt or html code
the clean these text and leave only the email address.
i need this script to insert it in one program.

pls help.

 
ok. thanks.
this second one is jscript. but also don't work.

i think is not your problem maybe of the program wich don't have all things.

i will ask the owner because i use it in trial version and for that i don't wanted to ask him.
 
it work with this but clean all html tags
this
Function Main ( strHTMLText )

dim strResult

strResult = StripHTMLTags ( strHTMLText )

Main = strResult

End Function

Function StripHTMLTags ( strHTMLText )

dim strResult

Set RegularExpressionObject = New RegExp

With RegularExpressionObject
.Pattern = "<[^>]+>"
.IgnoreCase = True
.Global = True
End With

strResult = RegularExpressionObject.Replace( strHTMLText , "")

Set RegularExpressionObject = nothing

StripHTMLTags = strResult

End Function


but don't work with your patern i tried to use your patern to clean only <a href tags but nothing.
 
ok. finally i managed to make it to work.
was this
Function Main ( strHTMLText )

dim strResult

strResult = StripHTMLTags ( strHTMLText )

Main = strResult

End Function

Function StripHTMLTags ( strHTMLText )

dim strResult

Set RegularExpressionObject = New RegExp

With RegularExpressionObject
.Pattern = "<a[^>]*>([\s\S]*?)</a>"
.IgnoreCase = True
.Global = True
End With

strResult = RegularExpressionObject.Replace( strHTMLText , "$1")

Set RegularExpressionObject = nothing

StripHTMLTags = strResult

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top