更新时间:2022-03-21 23:54:00
(1)重新读取语法详细信息(例如"\ alpanumeric")
(1) Re-read the syntax details (e.g. "\alpanumeric")
(2)搜索"LicenseDetail" +不是''的所有内容"
(2) Search for "LicenseDetail" + "everthing not a '"
在代码中:
Dim s : s = "height='40'><td colspan='1' width='20%' align='center'bgcolor='#e9edf2'><font face=verdana color=#000000 size=-1>Real Estate Broker or Sales</font></td><td colspan='1' align='center' bgcolor='#e9edf2'><font face=verdana color=#000000 size=-1><a href='LicenseDetail.asp?SID=&id=F5A76372AAA358B9CD869630255FA424'>ALMEIDA, JOHN SOBRAL</a></font></td"
Dim r : Set r = New RegExp
r.Pattern = "LicenseDetail[^']+"
Dim m : Set m = r.Execute(s)
If 1 = m.Count Then
WScript.Echo m(0).Value
Else
WScript.Echo "Bingo!"
End If
输出:
LicenseDetail.asp?SID=&id=F5A76372AAA358B9CD869630255FA424
更新wrt评论:
我不知道引号打到文件时wrt引号会变成双引号,但是我知道为什么[^"]
'不起作用':在VBScript中,字符串文字中的用"转义.在代码中:
I have no clue wrt quotes becoming double quotes when they hit a file, but I know why [^"]
'does not work': In VBScript, " in string literals are escaped by "". In code:
>> s = "name=""escapedquote"""
>> Set r = New RegExp
>> r.Pattern = """"
>> WScript.Echo s, r.Replace(s, "'")
>>
name="escapedquote" name='escapedquote"
>>
(转到此处,以查看正则表达式模式操作中的否定(双引号).)
(go to here to see negated (double) quotes in regular expression pattern action.)