作者vernc (cralvin)
看板EZsoft
标题Re: [请问] Ant Renamer的regexp问题(解答篇)
时间Sun Feb 26 16:06:08 2017
23_0023_24.jpg -> 023_023_024.jpg
input0014@
[email protected] -> input014@
[email protected]
18_0018.jpg -> 018_018.jpg
regexp版有位大大解出来了,是用//g
Global matching
The final two modifiers we will discuss here, //g and //c , concern multiple
matches. The modifier //g stands for global matching and allows the matching
operator to match within a string as many times as possible. In scalar
context, successive invocations against a string will have //g jump from
match to match, keeping track of position in the string as it goes along. You
can get or set the position with the pos() function.
这样写能处理上面三行,ant rename不能下//g、不过好像内建……
<Regexp Expr="(\d+)" Repl="00$1"/>
<Regexp Expr="0*(\d*)(\d{3})" Repl="$1$2"/>
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.236.88.23
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/EZsoft/M.1488096370.A.CA0.html
1F:推 mybaby520: 原来应该要这样解... 02/26 20:12