Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 如何删除每行中的第一个点,但仅当它存在时_Regex_Sublimetext3 - Fatal编程技术网

Regex 如何删除每行中的第一个点,但仅当它存在时

Regex 如何删除每行中的第一个点,但仅当它存在时,regex,sublimetext3,Regex,Sublimetext3,我有一个子域列表,我想删除一行开头的任何点,如果行的开头没有点,那么它会保持该行不变 像这个例子: x8.ext.indeed.com yk1.ext.indeed.com za.indeed.com zera.ext.indeed.com .envoy.eastus2.qa.notjet.net .envoy.westus.qa.notjet.net .nomad.eastus2.qa.notjet.net .nomad.westus.qa.notjet.net .notjet.net .to

我有一个子域列表,我想删除一行开头的任何点,如果行的开头没有点,那么它会保持该行不变

像这个例子:

x8.ext.indeed.com
yk1.ext.indeed.com
za.indeed.com
zera.ext.indeed.com
.envoy.eastus2.qa.notjet.net
.envoy.westus.qa.notjet.net
.nomad.eastus2.qa.notjet.net
.nomad.westus.qa.notjet.net
.notjet.net
.torbit.notjet.net
artifacts.notjet.net
bamf.notjet.net
bamfdb.notjet.net

对于这种情况,请使用行开始引用“^”和特定的点[.]与您的regexp匹配,将其约束为最小匹配+,因此您的regex将为:^[.]+


我建议regex101.com也尝试一下查询,如果你想突出显示它的工作原理:

Awesome man,它的工作原理完全符合我的要求。谢谢你的网站