;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfStrStripHtmlV1 (strHtml, strReplaceChar) objRE = ObjectCreate ("VBScript.RegExp") objRE.IgnoreCase = @FALSE ; Set case insensitivity. Default is @FALSE. objRE.Global = @TRUE ; Set global applicability. Default is @FALSE. objRE.Pattern = "<[^>]*>" ; objRegExp.Pattern = `<(.|\r|\n)*?>` strText = objRE.Replace(strHtml, strReplaceChar) objRE = 0 Return "" : strText ; Do not return VT_BSTR, but WB String_Unicode. ;.......................................................................................................................................... ; Inspired by ... ; Topic: httpStripHTML() - Unicode ; Conf: WinBatch ; From: deanad ; Date: Friday, June 22, 2012 10:39 AM ; ; (c)Detlev Dalitz.20120623. ;.......................................................................................................................................... #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfStrStripHtmlV2 (strHtml) objIE = ObjectCreate ("InternetExplorer.Application") objIE.visible = @FALSE objIE.navigate("about:blank") objDiv = objIE.Document.createElement("div") objDiv.innerHTML = strHtml strText = objDiv.InnerText objIE.quit objDiv = 0 objIE = 0 Return "" : strText ; Do not return VT_BSTR, but WB String_Unicode. ;.......................................................................................................................................... ; Note: Depending on IE this code does not include TITLE tag content in results. ; ; Inspired by ... ; Topic: httpStripHTML() - Unicode ; Conf: WinBatch ; From: deanad ; Date: Friday, June 22, 2012 09:53 AM ; ; (c)Detlev Dalitz.20120623. ;.......................................................................................................................................... #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ; Test. strHtml = "<HTML><HEAD><test>xxx</test><TITLE>Basic HTML Sample Page</TITLE></HEAD><BODY><CENTER" : @CRLF : "><H1>A Simple Sample Web Page<br>" : @CRLF : "³ÊÜößáïñ</H1></CENTER></BODY></HTML>" strText11 = udfStrStripHtmlV1 (strHtml, "|") ; "|||xxx||Basic HTML Sample Page|||||A Simple Sample Web Page|@CRLF³ÊÜößáïñ||||" Pause ("Example 1.1 - udfStrStripHtmlV1", strText11) strText12 = udfStrStripHtmlV1 (strHtml, "") ; "xxxBasic HTML Sample PageA Simple Sample Web Page@CRLF³ÊÜößáïñ" Pause ("Example 1.2 - udfStrStripHtmlV1", strText12) strText21 = udfStrStripHtmlV2 (strHtml) ; "xxxA Simple Sample Web Page@CRLF³ÊÜößáïñ" Pause ('Example 2 - udfStrStripHtmlV2', strText21) Exit