Simple Batch JScript Match And Replace Hybird

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
mojobadshah
Posts: 3
Joined: 27 Apr 2020 14:56

Simple Batch JScript Match And Replace Hybird

#1 Post by mojobadshah » 08 May 2020 18:31

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')

);

Post Reply