简体   繁体   English

Sublime Text 3正则表达式,查找多个-替换为一个

[英]Sublime Text 3 Regex, find multiple - replace with one

Using Sublime Text 3. Im lokking for a ([b0-9-]) strings in my text docs. 使用Sublime Text 3.在我的文本文档中寻找([b0-9-])字符串。 Having trouble to replace it with single character or a few. 无法用单个字符或几个字符替换它。 eg: b110-1.jpg & b110-2.jpg should be replaced with pic so after all this will look like 1.jpg or pic.jpg 例如: b110-1.jpgb110-2.jpg应该用pic代替,所以毕竟这看起来像1.jpgpic.jpg

You need to make the character class to repeat one or more times. 您需要使角色类重复一次或多次。 This should be achieved by adding + quantifier next to that character class. 这应该通过在该字符类旁边添加+量词来实现。

[b0-9-]+

replace with pic or 1 . pic1替换。

DEMO 演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM