开发者

How to strip out particular text using VBScript

开发者 https://www.devze.com 2023-04-03 16:30 出处:网络
I have got below te开发者_运维问答xt as string test = \"<span class=\'convert\'>USD 30</span>\"

I have got below te开发者_运维问答xt as string

test = "<span class='convert'>USD 30</span>"

I need to write a function in VBSCript which will take above string as input and will return USD 30 as output.

Please suggest


output = Replace (Replace(test , "<span class='convert'>",""),"</span>","")


If your input text is more complicated than the example you've given, I would recommend using an XML library such as MSXML to parse the text. Otherwise, you can use a regex

Const test = "<span class='convert'>USD 30</span>"
dim regex: set regex = new RegExp
regex.pattern = ">([^<]*)"
dim matches: set matches = regex.execute(test)
dim output: output = Empty
if matches.Count <> 0 then
    output = matches(0).submatches(0)
end if
Response.Write output
0

精彩评论

暂无评论...
验证码 换一张
取 消