JREPL.BAT JScript实现的批处理正则表达式库 JREPL

  • 批处理大小:76KB
  • 批处理语言:简体中文
  • 批处理类型:国产软件
  • 批处理授权:免费软件
  • 更新时间:2017-01-02
  • 批处理类别:其它
  • 相关链接:
  • 网友评分:软件评分
  • 应用平台:Windows平台
软件介绍人气软件相关文章下载地址↓

JREPL.BAT - regex text processor ,可以在dos命令下通过正则表达式匹配txt中的内容,类似linux的命令行工具了,喜欢windows界面的朋友可以查看脚本之家的在线测试工具支持高亮。

Here is the current version of JREPL.BAT. Read the subsequent posts for examples of usage and to follow the development history.

JREPL.BAT is a powerful, general purpose, command line, regular expression text processor for ASCII data. It is a hybrid JScript/batch script that should run on any Windows machine from XP onward.

Here is a trivial example that will substitute "blue" for every occurrence of the word "red" within a file. Changes are made directly to the file:

jrepl "\bred\b" "blue" /f test.txt /o -

If the command is used in a batch script, then CALL must be used so that the calling script can continue after JREPL finishes.

Full documentation can be accessed by using the following:

jrepl /?

JREPL.BAT is a direct descendent from REPL.BAT. A new name was needed because the calling syntax is not backward compatible.

JREPL.BAT uses the same options as REPL.BAT, except instead of concatenating all the options into one string, each option must be listed separately with a slash prefix.

Besides having different calling syntax, JREPL version 1.0 offers the following enhancements over REPL.BAT version 6:
The input file may be specified using /F "file". No need to pipe or redirect the input file.
The output may be sent to a file using /O "file". No need to redirect the output.
/O "-" will replace the original file with the result. The output is first written to a temporary file, and then it is MOVEd to replace the original.
/JMATCH discards all non-matching text, and each match's replacement value is written on a new line. The replacement value is expressed as JScript code.
/JBEG "code" and /JEND "code" run initialization and termination JSCRIPT code supplied by the user. User defined global variables can be declared and initialized within the /JBEG code. Then the /J or /JMATCH Replacement code can update the variables upon each match. Finally, the /JEND code can write summarized information upon completion.
/N "width" prefixes each line of output with the corresponding line number from the input. The line numbers may be zero padded to a minimum width.
/OFF "width" prefixes each line of /JMATCH output with the offset within the source line where the match occurred. The offsets may be zero padded to a minimum width.
Expanded the number of predefined global variables/methods/objects that may be used by user supplied JScript code.
All global variables/methods/objects used by the JREPL script itself are hidden behind a single opaque global object named "_g". User supplied code can create identifiers without fear of corrupting the JREPL script as long as the _g object is avoided.

Please let me know if you find any bugs - I've done rudimentary testing, but I do not yet have a regression test plan, and the code has grown substantially since the original version of REPL.BAT. I may have unknowingly broken code that worked previously.


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.

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
v6.6 New /RTN option to store result in a variable. Improved support for extended ASCII. Fixed documentation error introduced by version 6.0
v6.4 Improved peformance by dynamically building optimized main loop based on chosen options
v6.2 Added /K /R /MATCH /P /PFLAG /JQ /JQMATCH. Improved /INC /EXC. Improved Performance.
v5.2 Added /T FILE option
v5.0 Added /U option
v4.5 Added /D option
v4.4 Bug fix for /C when last line missing \n
v4.3 Added rpad() and improved lpad()
v4.2 Improved /?Options help
v4.1 Added help for single option/topic as well as /T examples
v4.0 Added /INC and /EXC
v3.8 Bug fix - hide some additional internal variables
v3.7 Bug fix for \xnn and \unnnn in regex with /X
v3.6 Added /?? paged help option
v3.5 /T bug fix for $n and $nn when not /J or /JMATCH
v3.4 "Hide" internal /TEST variable (instead of TEST)
v3.3 Added /JLIB plus some bug fixes
v3.0 Added /JBEGLN and /JENDLN
v2.2 Added /T option
v1.0 Initial release

Dave Benham

截图:

警告:运行BAT源码是一种危险的动作,如果你不熟悉,请不要尝试!

人气批处理
下载地址
下载错误?【投诉报错】
相关批处理
网友评论
下载声明

☉ 解压密码或分享码:www.jb51.net 就是本站主域名,希望大家看清楚,[ 分享码的获取方法 ]可以参考这篇文章
☉ 推荐使用 [ 迅雷 ] 下载,使用 [ WinRAR v5 ] 以上版本解压本站软件。
☉ 如果这个软件总是不能下载的请在评论中留言,我们会尽快修复,谢谢!
☉ 下载本站资源,如果服务器暂不能下载请过一段时间重试!或者多试试几个下载地址
☉ 如果遇到什么问题,请评论留言,我们定会解决问题,谢谢大家支持!
☉ 本站提供的一些商业软件是供学习研究之用,如用于商业用途,请购买正版。
☉ 本站提供的JREPL.BAT JScript实现的批处理正则表达式库 JREPL资源来源互联网,版权归该下载资源的合法拥有者所有。