正则表达式与批量替换工具

概述使用经验工具与使用教程windows下的正则式工具介绍之一:RegexBuddy

涉及到要对批量的文件甚至是批量的待替换字符串进行查找与替换时,正则表达式与GREP工具就显得强大无敌了。

PowerGrep是最强大的工具但输入一连串的正则待替换字符串时稍显繁琐,而UltraReplace虽然不成熟,但是输入规则方面有一个很方便的地方,就是输入框会保留上一次的显示内容,所以可以直接在上一次的正则表达式上直接编辑就形成下一个表达式,依此类推可以节省很多重复动作。所以可以在UltraReplace输入编辑完大量规则后一一直接COPY回PowerGrep的规则框内,虽然动作枯燥单调,但是不会出错。也可以导出UltraReplace的规则,然后修改成适合PowerGrep的XML配置的.pga文件,不过这个动作比较费脑筋,容易出错。

正则表达式批量替换工具:

 

windows下的正则式工具介绍之二:powergrep

windows下的正则式工具介绍之三:MTracer2.0介绍以及与RegexBuddy比较

数据采集利器PowerGREP10分钟上手指南 这个软件,速度还是比较快的。不过这个软件比较消耗内存。另外需要注意一点,就是文件的编码,需要在reference里面的encode指定。 我使用powergrep的一点体会

UltraReplace超级批量文本替换,免费但尚未成熟的国产软件,对正则表达式的支持尚可但是经常软件异常。

正则表达式验证工具:

与正则表达式相关的几个小工具

正则表达式测试软件(Regex) V0.5.0.2

RegeX 可视化正则表达式替换器 (SearchRex) RegeX使用教程

正则表达式验证器RegexTester

正则表达式测试工具 (阿良原创)

options: -s single-line mode -m multi-line mode -i ignoreCase -G global -R from right to left -E extended-regexp pattern ERE -e ="PAT-regexp" -C ="strToOperate" -F fixed-strings fgrep -c ="num" print only a count of matching first lines per file -n force the prefixing filename on output -N without prefixing filename on output -o show only the part of the line that matched -f ="file" read regex patterns from file -q quiet suppress all normal output,stderr etc -O output file offsets, not text -x print line number with output lines -r recursively scan sub-directories -I select only non-matching lines -S ="replaceto" Match(regexp)-->replaceto -p ="bak-suffix-name",Modify file(S) directly,will create backup file(s) if bak- suffix-name is not null -d ="dir to search" default=currentDirectory,dir-str can't end with \",avoid esc ape " -X mask filename to be operated with regex -T only output filename and match num for per file search file:if set the -e arg and no (-C arg || stdin-pipe || inputfile),then ou tput filepath that match -ergx;if -o arg is set,output filenames only 从命令行中-C参数指定要处理的字符串: C:\>E:\MyProjects1117\deelxGrepSed\Debug\deelxgrep.exe -Chello2012 -e2\d+2 Line:1 Offset:5 hello2012 //output -o参数指定只输出匹配部分: C:\>E:\MyProjects1117\deelxGrepSed\Debug\deelxgrep.exe -Chello2012 -e2\d+2 -o 2012 从标准输入 管道里获取要处理的数据 C:\>help |E:\MyProjects1117\deelxGrepSed\Debug\deelxgrep.exe -e^V.+?\s -o VERT VE VER VER VERIFY VOL 从文件里读取数据处理,支持递归处理目录 E:\MyProjects1117\deelxGrepSed\Release>deelxgrep.exe -ewindows Boo-t.ini -i Boo-t.ini result : Line:3 Offset:45 (0)partition(1)\WINDOWS [operating sys Line:5 Offset:37 (0)partition(1)\WINDOWS="Microsoft Wind Line:5 Offset:56 DOWS="Microsoft Windows XP Professional -d指定目录,-r表示递归处理 -e指定要查找的表达式,如果没有带处理数据(即没有-C\管道输入\指定文件)但指定了目录,则会 处理目录下的目录名和文件名,并输出符合表达式的路径名称 E:\MyProjects1117\deelxGrepSed\Release>deelxgrep.exe -eboot.i*i -i -d"c:" -r c:\boot.ini E:\MyProjects1117\deelxGrepSed\Release>deelxgrep.exe -eboot.i*i -i -d"c:\\"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值