Atom.io搜索字段中的正则表达式

问题描述 投票:0回答:1

所以,例如,我有这个列表:

10text
11text
12text
13text
14text
15text
16text
17text
18text
19text

现在我需要复制它并使用正则表达式将其全部放入20-2930-39范围。

所以只有第一个1需要变成23等。

我似乎无法弄清楚正则表达式是什么。

我试过:1.text 1*text

现在我一直在做一些阅读,可能因为它不是我的母语,对我来说仍然是神奇的。

http://www.ntu.edu.sg/home/ehchua/programming/howto/regexe.html

https://www.regular-expressions.info/tutorial.html

http://2017.compciv.org/guide/topics/end-user-software/atom/how-to-use-regex-atom.html

Reference - What does this regex mean?

https://stackoverflow.com/tags/regex/info

我希望的是什么

当我在搜索字段中填写此内容时:

1*text

这在替换字段中:

2*text

然后按下更改所有列表变为

20text
21text
22text
23text
24text
25text
26text
27text
28text
29text
regex
1个回答
2
投票

我不知道你到底想要做什么,但如果你想将1xtext转换为2xtext,那么尝试搜索这个模式:

^1

然后用2替换。或者,更一般地说,为了匹配像(1xtext)这样的东西你可以尝试使用模式\b1,并再次用2替换。

© www.soinside.com 2019 - 2024. All rights reserved.