Regular expression in VBScript

Home Forums Scripting Windows Script Host Regular expression in VBScript

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    h0ndzik
    Member
    #159149

    Hi all
    I have script which get http content and then search string. But when I want use regular in search string, it not work (regular: .*?). Also I using double quotes marks to express single quote mark.
    Any idea how rewrite script? Search string with regular works fine outside vscript
    Best regards.

    server = “1.2.3.4”
    link = “/443/link”
    Set Http = CreateObject(“WinHttp.WinHttpRequest.5.1”)
    Http.SetClientCertificate “LOCAL_MACHINEMYcert”
    Http.Option(4) = 256 + 512 + 4096 + 8192
    Http.Open “GET”, “https://” & server & “:” & link, false
    Http.Send
    out = Http.ResponseText

    If InStr(1,out,”banner:apps:1:app:link::ILinkListener::””.*?class=””selected”””) Then
    wscript.echo “ok”
    Else
    wscript.echo “error”
    End If

    Set Http = Nothing
    [/CODE][CODE]
    server = “1.2.3.4”
    link = “/443/link”
    Set Http = CreateObject(“WinHttp.WinHttpRequest.5.1”)
    Http.SetClientCertificate “LOCAL_MACHINEMYcert”
    Http.Option(4) = 256 + 512 + 4096 + 8192
    Http.Open “GET”, “https://” & server & “:” & link, false
    Http.Send
    out = Http.ResponseText

    If InStr(1,out,”banner:apps:1:app:link::ILinkListener::””.*?class=””selected”””) Then
    wscript.echo “ok”
    Else
    wscript.echo “error”
    End If

    Set Http = Nothing
    [/CODE]

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.