![]() |
|
|
|||||||
| Petri.co.il is happy to award auglan the title of Most Valuable Member !!! |
| Register | Calendar |
Search |
Today's Posts |
Mark Forums Read |
| Notices |
|
|
Regular expression in VBScriptthis thread has 2 replies and has been viewed 986 times
|
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||||||
|
||||||||
|
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. Code:
server = "1.2.3.4"
link = "/443/link"
Set Http = CreateObject("WinHttp.WinHttpRequest.5.1")
Http.SetClientCertificate "LOCAL_MACHINE\MY\cert"
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
|
|
#2
|
||||||||||
|
||||||||||
|
you can try,
Code:
Set Http = CreateObject("WinHttp.WinHttpRequest.5.1")
server = "1.2.3.4"
link = "/443/link"
With Http
.SetClientCertificate "LOCAL_MACHINE\MY\cert"
.Option(4) = 256 + 512 + 4096 + 8192
.Open "GET", "https://" & server & ":" & link, false
.Send
out = .ResponseText
End With
Set Http = Nothing
Set re = new regexp : re.Global = true : re.IgnoreCase = true
wildcard = ".*?"
re.Pattern = "banner:apps:1:app:link::ILiNKListener::""" & wildcard & "class=""selected"""
If re.Test(out) then
wscript.echo "ok"
Else
wscript.echo "error"
End If
__________________
This posting is provided "AS IS" with no warranties, and confers no rights. __________________ ** Remember to give credit where credit's due ** and leave Reputation Points for meaningful posts |
|
#3
|
||||||||
|
||||||||
|
Hi Rems, thank you very much for help! It works now.
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Assistance with an expression using Report Builder 3.0 | Virtual | SQL Server 2008 / R2 | 0 | 23rd April 2012 16:37 |
| VBScript in Windows server 2008 R2 (VBScript 5.8), I cannot seem to find anything | Chromebuster | General Scripting | 9 | 28th February 2011 14:10 |
| Wireshark - queries/filter/expression for nbns | glacieredlightning | General Networking | 5 | 25th November 2008 22:14 |
| VBScript - Trapping Control-CI have some vbscript running in the cscript host for whi | humbletech99 | General Scripting | 0 | 27th December 2007 15:40 |
| active directory search expression | jarvip | Active Directory | 3 | 9th December 2006 21:41 |