Объект RegExp

Метасимволы

(?!шаблон)

Описание:

"Windows(?!95|98)" подберёт подстроку "Windows" в строке "WindowsNT", но не в строке "Windows95". В остальном - полностью аналогично "(?=шаблон)".

Пример:

Set objRegExp = CreateObject("VBScript.RegExp")
objRegExp.Global = True
Str = "WindowsWindowsWindows"
objRegExp.Pattern = "Windows(?!Win)"
Set objMatches = objRegExp.Execute(Str)
MsgBox objMatches.Count
For i=0 To objMatches.Count-1
    MsgBox objMatches.Item(i).Value
Next

© 2004 http://small.h12.ru