当我在https://regex101.com (<meta[^>]*description[^>]([^<]+)>)
上使用此正则表达式时,它会运行。
Match 1
Full match 265-314 `<meta name="description" content="Stackoverflow">`
Group 1. 265-314 `<meta name="description" content="Stackoverflow">`
Group 2. 289-313 ` content="Stackoverflow"
但是当我在我的页面上使用它时它不会运行。
Function GetFirstMatch(PatternToMatch, StringToSearch)
Set regEx = New RegExp
regEx.Pattern = PatternToMatch
regEx.IgnoreCase = True
regEx.Global = True
regEx.MultiLine = True
Set CurrentMatches = regEx.Execute(StringToSearch)
GetFirstMatch = ""
If CurrentMatches.Count >= 1 Then
Set CurrentMatch = CurrentMatches(0)
If CurrentMatch.SubMatches.Count >= 1 Then
GetFirstMatch = CurrentMatch.SubMatches(0)
End If
End If
Set regEx = Nothing
End Function
GetFirstMatch("(<meta[^>]*description[^>]([^<]+)>)",sdatai)
谢谢你