24 lines
545 B
Plaintext
24 lines
545 B
Plaintext
Dim pat, patparts, rxp, inp, found
|
|
pat = WScript.Arguments(0)
|
|
pat = Replace(pat, """, chr(34))
|
|
pat = Replace(pat, "&hat;", "^")
|
|
pat = Replace(pat, "&", "&")
|
|
patparts = Split(pat,"/")
|
|
Set rxp = new RegExp
|
|
found = False
|
|
rxp.Global = True
|
|
rxp.Multiline = False
|
|
rxp.Pattern = patparts(0)
|
|
Do While Not WScript.StdIn.AtEndOfStream
|
|
inp = WScript.StdIn.ReadLine()
|
|
If not found Then
|
|
If rxp.Test(inp) Then
|
|
found = True
|
|
End If
|
|
End If
|
|
WScript.Echo rxp.Replace(inp, patparts(1))
|
|
Loop
|
|
If not found Then
|
|
WScript.Quit(2)
|
|
End If
|