
question about regular expression
Quote:
> But I can't find difference between normal search and positive
> lookahead search
> for example there's sentences like "windows98 is here" and
> "windows2000 is there"
> then normal search windows(98|2000) will match both sentences
> and positive lookahead search windows(?=98|2000) also match both
> sentences
> Well, I think I'm misunderstanding the meaning of positive lookahead
> search :)
> plz show me some example or explanation
The difference is what gets matched. Positive (and negative) lookaheads are not
part of the match.
win98 = "windows98 is here"
win2k = "windows2000 is there"
with new regexp
'match the string "windows98" or "windows2000"
.pattern = "windows(98|2000)"
wscript.echo .execute(win98)(0) ' windows98
wscript.echo .execute(win2k)(0) ' windows2000
'match the string "windows", but only if it's followed by "98" or "2000"
.pattern = "windows(?=98|2000)"
wscript.echo .execute(win98)(0) ' windows
wscript.echo .execute(win2k)(0) ' windows
end with
--
Steve
Washing one's hands of the conflict between the powerful and the powerless
means to side with the powerful, not to be neutral. -Paulo Freire