Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.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_Sublimetext2_Sublimetext - Fatal编程技术网

Regex 我怎样才能用:?

Regex 我怎样才能用:?,regex,sublimetext3,sublimetext2,sublimetext,Regex,Sublimetext3,Sublimetext2,Sublimetext,您好,我的文本中有这样的行: Test | (4079|5657|5914) 我想用正则表达式来表示: Test | (4079:5657:5914) 我试过这个 替换此:([0-9](3)|[0-9](3)|[0-9](3)) 通过此:([0-9](3):[0-9](3):[0-9](3)) 但它不起作用 多谢各位 您可以尝试此查找和替换: Find: \((\d+)\|(\d+)\|(\d+)\) Replace: ($1:$2:$3) 这似乎在a中起作用。您可以使用Find

您好,我的文本中有这样的行:

Test | (4079|5657|5914) 
我想用正则表达式来表示:

Test | (4079:5657:5914) 
我试过这个

替换此:
([0-9](3)|[0-9](3)|[0-9](3))
通过此:
([0-9](3):[0-9](3):[0-9](3))

但它不起作用


多谢各位

您可以尝试此查找和替换:

Find:    \((\d+)\|(\d+)\|(\d+)\)
Replace: ($1:$2:$3)

这似乎在a中起作用。

您可以使用Find并替换为regex

  • 在升华文本中按Ctrl+H
  • 选择正则表达式
  • 输入以下内容

    查找:
    (\d+)\ |

    替换:
    $1:

  • 点击“全部替换”

输入:

Test | (4079|5657|5914)
Test | (4079|5657|5914|1224344|123) 
输出

Test | (4079:5657:5914)
Test | (4079:5657:5914:1224344:123) 

注意:要匹配3个连续数字,您需要使用
[0-9]{3}
。括号里能有更多的数字吗?还有其他号码吗?比如
(23 | 234 | 42353 | 43234 | 3)