sublimetext3 - 我需要一个正则表达式来替换语法
问题描述
我是 sublime text3 的新手,但开始喜欢在其中工作。
我正在使用它的搜索和替换来实现如下:
我有一个数百个项目的列表,如下所示:
第5149章 第5427章 5036:卡洛乔里奥卡普提 5071:卡洛·乔里奥·斯莱斯 第5466章
但我想用
5149- 5427- 5036- 5071- 5466-
所以基本上冒号和单词应该用连字符(-)符号替换
我尝试了一些正则表达式。例如: (?<=WORD).*$
但事情不正常。
解决方案
I tried myself and finally got the expression that works for my requirement.
In the find area type:
: [a-zA-Z\d" "]+
And in the replace area type:
-
This gives you the numbers followed by a hiphen and eliminating the words.
推荐阅读
- c# - 可从 IMultiValueConverter 访问的 DataContext
- c++ - 使用智能指针的 OOP 父/子关系
- php - 在 CentOS 7 中设置 PHP 的默认版本
- java - Java Streams – 如何按值分组并找到每个组的最小值和最大值?
- typescript - 无法使用 routerlink 导航
- javascript - 如何使用 bindingHandler 两次
- java - YAML 使用 SnakeYAML JAVA 合并单个序列并反序列化
- unity3d - 如何统一更改另一个脚本的值?
- java - 如何修改这个将字节转换为字符串的方法,以便它可以将字符串转换为字节?
- r - 在 KFAS 上自动使用 SSMcustom 以获得时间序列每日效果