JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Posted: 14 Nov 2014 14:52
Here is the current version of JREPL.BAT as of 2020-07-30. Read the subsequent posts for examples of usage and to follow the development history.
Full documentation is available from the command line via JREPL /?, or JREPL /?? for paged help.
The entire documentation is also listed at the top of the code, after the history.
Help is also available for specific topics - use JREPL /?HELP for more info.
Unfortunately the code has gotten too big to post on this site as view-able text. More than half the code is documentation
Index of releases
v8.6 2020-07-30: Extended /K /R and /MATCH syntax to support counting matches or rejects instead of printing them. Also added the counter JScript global variable for user JScript.
v8.5 2020-02-29: Added the /EOL option and the eol JScript global variable for user JScript
v8.4 2019-09-13: Bug fix for /RTN - use UTF-8 and CHCP 65001 to preserve Unicode when storing the result in the environment variable. Also fixed v8.0 bug that broke /K,/R with /INC,/EXC.
v8.1 2019-05-19: Add /VT to enable ANSI escape sequences without having to modify the registry.
v8.0 2019-05-15: Add /H /HON /HOFF and /HU options for highlighting replaced or matched text. Fixed behavior of /OFF when combined with /P.
v7.15 2018-10-20: Extend /INC and /EXC to support 'String' literals
v7.14 2018-10-15: Bug fix to allow user defined variables str and/or obj, and to hide xbytes from user code.
v7.13 2018-07-18: Added ability to create XBYTES.DAT via ADO in case CERTUTIL is missing, Fixed minor bug related to XBYTES.DAT that was sometimes leaving behind one or more copies of XBYTES.HEX, and Fixed major bug with /INC and /EXC regular expression blocks.
v7.11 2018-03-26: Added functionality to overwrite input file as ADO UTF without BOM (added support for /O "-|UTF-?|NB").
v7.10 2018-03-14: Now can block BOM in ADO output files by appending |NB to |CharSet in the /O option and OpenOutput() function.
v7.9 2017-11-23: Allow escape sequences with /T "", New /PREPL option to improve /P functionality, plus two minor bug fixes
v7.8 2017-11-13: Emulate FINDSTR /G; Split /X into /XSEQ and /XFILE; New \x{nn-mm} escape sequence
v7.7 2017-10-24: Fixed broken MicroSoft links; Allow /O "-|CharSet"; fix decode() bug - make CharSet arg optional
v7.6 2017-10-08: New /?CHARSET/[Query] list character sets help option, New /?CHARSET and /?XREGEXP web page help options, and minor bug fix to output.WriteLine()
v7.4 2017-09-25: Modified /X \xnn extended ASCII escape sequence to support any single byte character set, not just Windows-1252
v7.3 2017-09-23: Added ability to select character set for input and output, including Unicode. Also added support for XRegExp enhanced regular expressions
v6.8 2017-08-25: Added \c escape sequence for /X, added /APP option, and added openOutput() function.
v6.7 2017-04-09: Corrected /OFF, /EXC, and /INC documentation, plus spelling fixes.
v6.6 2016-12-23: New /RTN option to store result in a variable. Improved support for extended ASCII. Fixed documentation error introduced by version 6.0
v6.4 2016-11-01: Improved peformance by dynamically building optimized main loop based on chosen options
v6.2 2016-10-13: Added /K /R /MATCH /P /PFLAG /JQ /JMATCHQ. Improved /INC /EXC. Improved Performance.
v5.2 2016-09-27: Added /T FILE option
v5.0 2016-09-18: Added /U option
v4.5 2016-08-03: Added /D option
v4.4 2016-08-02: Bug fix for /C when last line missing \n
v4.3 2016-07-30: Added rpad() and improved lpad()
v4.2 2016-06-24: Improved /?Options help
v4.1 2016-06-23: Added help for single option/topic as well as /T examples
v4.0 2016-06-19: Added /INC and /EXC
v3.8 2016-03-27: Bug fix - hide some additional internal variables
v3.7 2016-01-14: Bug fix for \xnn and \unnnn in regex with /X
v3.6 2015-07-15: Added /?? paged help option
v3.5 2015-06-12: /T bug fix for $n and $nn when not /J or /JMATCH
v3.4 2015-01-22: "Hide" internal /TEST variable (instead of TEST)
v3.3 2014-12-24: Added /JLIB plus some bug fixes
v3.0 2014-11-23: Added /JBEGLN and /JENDLN
v2.2 2014-11-21: Added /T option
v1.0 2014-11-14: Initial release
Dave Benham
Full documentation is available from the command line via JREPL /?, or JREPL /?? for paged help.
The entire documentation is also listed at the top of the code, after the history.
Help is also available for specific topics - use JREPL /?HELP for more info.
Unfortunately the code has gotten too big to post on this site as view-able text. More than half the code is documentation
Index of releases
v8.6 2020-07-30: Extended /K /R and /MATCH syntax to support counting matches or rejects instead of printing them. Also added the counter JScript global variable for user JScript.
v8.5 2020-02-29: Added the /EOL option and the eol JScript global variable for user JScript
v8.4 2019-09-13: Bug fix for /RTN - use UTF-8 and CHCP 65001 to preserve Unicode when storing the result in the environment variable. Also fixed v8.0 bug that broke /K,/R with /INC,/EXC.
v8.1 2019-05-19: Add /VT to enable ANSI escape sequences without having to modify the registry.
v8.0 2019-05-15: Add /H /HON /HOFF and /HU options for highlighting replaced or matched text. Fixed behavior of /OFF when combined with /P.
v7.15 2018-10-20: Extend /INC and /EXC to support 'String' literals
v7.14 2018-10-15: Bug fix to allow user defined variables str and/or obj, and to hide xbytes from user code.
v7.13 2018-07-18: Added ability to create XBYTES.DAT via ADO in case CERTUTIL is missing, Fixed minor bug related to XBYTES.DAT that was sometimes leaving behind one or more copies of XBYTES.HEX, and Fixed major bug with /INC and /EXC regular expression blocks.
v7.11 2018-03-26: Added functionality to overwrite input file as ADO UTF without BOM (added support for /O "-|UTF-?|NB").
v7.10 2018-03-14: Now can block BOM in ADO output files by appending |NB to |CharSet in the /O option and OpenOutput() function.
v7.9 2017-11-23: Allow escape sequences with /T "", New /PREPL option to improve /P functionality, plus two minor bug fixes
v7.8 2017-11-13: Emulate FINDSTR /G; Split /X into /XSEQ and /XFILE; New \x{nn-mm} escape sequence
v7.7 2017-10-24: Fixed broken MicroSoft links; Allow /O "-|CharSet"; fix decode() bug - make CharSet arg optional
v7.6 2017-10-08: New /?CHARSET/[Query] list character sets help option, New /?CHARSET and /?XREGEXP web page help options, and minor bug fix to output.WriteLine()
v7.4 2017-09-25: Modified /X \xnn extended ASCII escape sequence to support any single byte character set, not just Windows-1252
v7.3 2017-09-23: Added ability to select character set for input and output, including Unicode. Also added support for XRegExp enhanced regular expressions
v6.8 2017-08-25: Added \c escape sequence for /X, added /APP option, and added openOutput() function.
v6.7 2017-04-09: Corrected /OFF, /EXC, and /INC documentation, plus spelling fixes.
v6.6 2016-12-23: New /RTN option to store result in a variable. Improved support for extended ASCII. Fixed documentation error introduced by version 6.0
v6.4 2016-11-01: Improved peformance by dynamically building optimized main loop based on chosen options
v6.2 2016-10-13: Added /K /R /MATCH /P /PFLAG /JQ /JMATCHQ. Improved /INC /EXC. Improved Performance.
v5.2 2016-09-27: Added /T FILE option
v5.0 2016-09-18: Added /U option
v4.5 2016-08-03: Added /D option
v4.4 2016-08-02: Bug fix for /C when last line missing \n
v4.3 2016-07-30: Added rpad() and improved lpad()
v4.2 2016-06-24: Improved /?Options help
v4.1 2016-06-23: Added help for single option/topic as well as /T examples
v4.0 2016-06-19: Added /INC and /EXC
v3.8 2016-03-27: Bug fix - hide some additional internal variables
v3.7 2016-01-14: Bug fix for \xnn and \unnnn in regex with /X
v3.6 2015-07-15: Added /?? paged help option
v3.5 2015-06-12: /T bug fix for $n and $nn when not /J or /JMATCH
v3.4 2015-01-22: "Hide" internal /TEST variable (instead of TEST)
v3.3 2014-12-24: Added /JLIB plus some bug fixes
v3.0 2014-11-23: Added /JBEGLN and /JENDLN
v2.2 2014-11-21: Added /T option
v1.0 2014-11-14: Initial release
Dave Benham