Page 1 of 1

Simple Batch JScript Match And Replace Hybird

Posted: 08 May 2020 18:31
by mojobadshah
What can I do to modify a regular expression batch/JScript hybrid like this one in order to perform a RegExp replace !!after a RegExp match? These will work when match is either the last string in an expression or on its own.

Code: Select all

@set @a=0  /*
@cscript //nologo //E:JScript "%~F0" < sample1.txt > sample2.txt
@goto :EOF */

WScript.Stdout.Write(WScript.StdIn.ReadAll()

.match(/b/gmi,'$&')

.replace(/b/gmi,'c')

);