Text 记事本++;如何交换两个if-and-then语句
所以我有一些代码需要修改(1000行),我想从这里开始Text 记事本++;如何交换两个if-and-then语句,text,expression,notepad++,swap,Text,Expression,Notepad++,Swap,所以我有一些代码需要修改(1000行),我想从这里开始 if $one=0 and $two=32 then $dist=1 if $one=0 and $two=15 then $dist=2 if $one=0 and $two=19 then $dist=3 对此 if $one=0 and $dist=1 then $two=32 if $one=0 and $dist=2 then $two=15 if $one=0 and $dist=3 then $two=19 简单地说,用$
if $one=0 and $two=32 then $dist=1
if $one=0 and $two=15 then $dist=2
if $one=0 and $two=19 then $dist=3
对此
if $one=0 and $dist=1 then $two=32
if $one=0 and $dist=2 then $two=15
if $one=0 and $dist=3 then $two=19
简单地说,用$dist及其值交换$two及其值
记事本++的正则表达式会发生这种情况吗?干杯
(\$two=\d+)(然后)(\$dist=\d+)
$3$2$1
(\$two=\d+) : group 1, contains "$two=1 or more digits"
(\s+then\s+) : group 2, literally "then" surrounded by spaces
(\$dist=\d+) : group 3, contains "$dist=1 or more digits"
$3$2$1 : group 3 group 2 group 1
if $one=0 and $dist=1 then $two=32
if $one=0 and $dist=2 then $two=15
if $one=0 and $dist=3 then $two=19
\$
必须转义,因为它是正则表达式中的特殊字符
更换:
(\$two=\d+) : group 1, contains "$two=1 or more digits"
(\s+then\s+) : group 2, literally "then" surrounded by spaces
(\$dist=\d+) : group 3, contains "$dist=1 or more digits"
$3$2$1 : group 3 group 2 group 1
if $one=0 and $dist=1 then $two=32
if $one=0 and $dist=2 then $two=15
if $one=0 and $dist=3 then $two=19
给定示例的结果:
(\$two=\d+) : group 1, contains "$two=1 or more digits"
(\s+then\s+) : group 2, literally "then" surrounded by spaces
(\$dist=\d+) : group 3, contains "$dist=1 or more digits"
$3$2$1 : group 3 group 2 group 1
if $one=0 and $dist=1 then $two=32
if $one=0 and $dist=2 then $two=15
if $one=0 and $dist=3 then $two=19
我没有投你反对票,但是你试过什么吗?是的----------如果([^]+)和([^]+)那么([^]+)为什么投反对票?这个问题这么傻吗?