我可以使用搜索/替换和正则表达式来增加计数器吗?
我有一个文件名列表,我想更改它以包含计数器:
asdf.jpg to become id:001, name:asdf.jpg
lkh.jpg to become id:002, name:lkh.jpg
在 Aptana Studio 3 编辑器中,我可以使用搜索/替换正则表达式来增加计数器吗?
谢谢
I have a list of file names which I want to change to include a counter:
asdf.jpg to become id:001, name:asdf.jpg
lkh.jpg to become id:002, name:lkh.jpg
In Aptana Studio 3 editor can I use a search/replace regular expression to increment the counter?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无法像您使用正则表达式描述的那样进行索引替换。如果您的列表是连续的,并且没有包含在标记中,那么任何语言的快速脚本都可以为您处理替换。例如,在 JavaScript 中......
(这段代码又快又脏,没有朋友,在小学时被嘲笑,但完成了工作。)
There is no way to do an indexed replace like you described using regular expressions. If your list is sequential, and not wrapped up in markup, then a quick script in any language could handle the replacements for you. For instance, in JavaScript...
(This code is quick and dirty, has no friends, and was teased in grade school, but gets the job done.)