regex - vbscript regular expression into an array -


with code below trying pull each url extract using regular expression array can call later along count of urls. not sure how grab of them.

set objxmlhttp = createobject("microsoft.xmlhttp") call objxmlhttp.open("get", "website", false) objxmlhttp.send()  strhtml = objxmlhttp.responsetext  dim objregexp set objregexp = new regexp  objregexp.ignorecase = true objregexp.global = true objregexp.pattern = "<a\s+href=""(http://.*?)""[^>]+>(\s*\n|.+?\s*)</a>"  dim objmatch each objmatch in objregexp.execute(strhtml)   objmatch.submatches(0) next  set objxmlhttp = nothing 

i tested fake string, regexp results seemed bit wonky changed (grabbed here). results of 1st match (you capture 2?) placed in matches array:

dim objregexp set objregexp = new regexp  objregexp.ignorecase = true objregexp.global = true objregexp.pattern = ""((https?:\/\/|www.)([-\w.]+)+(:\d+)?(\/([\w\/_.]*(\?\s+)?)?)?)""  dim matches() dim i: = 0  dim objmatch each objmatch in objregexp.execute(strhtml)    redim preserve matches(i)    matches(i) = objmatch.submatches(0)    = (i + 1) next  set objxmlhttp = nothing  '//read = 0 ubound(matches)    wscript.echo matches(i) next 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -