0

我试图从线条中找到弓然后用专业 替换专业(aspeed 700)

用记事本++正则表达式

(item (name 767) (Index 567) (Image "wea098") (Action 10 2) (class weapon bow) (code 1 2 2 2) (country 2) (level 56) (wear 1) (limit archer 56) (range 176) (buy 0) (sell 1) (endurance 30) (maxprotect 150) (specialty    (Str 1) (Dex 4) (Attack 172 232) (hp 150) (mp 50) (hit 72)))

(item (name 770) (Index 570) (Image "wea101") (Action 10 2) (class weapon wand) (code 1 2 1 3) (country 2) (level 56) (wear 1) (limit mage 56) (range 18) (buy 0) (sell 1) (endurance 30) (maxprotect 150) (specialty   (aspeed 1000) (Int 5) (Attack 150 160) (Magic 220 300) (mp 250) (hit 64)))

我试过

Find What : .*class\s*weapon\s*bow.*specialty[^.]
Replace With \1 (aspeed 700)

结果是:

(aspeed 700)   (Str 1) (Dex 4) (Attack 172 232) (hp 150) (mp 50) (hit 72)))

我想要的结果应该是:

(item (name 767) (Index 567) (Image "wea098") (Action 10 2) (class weapon bow) (code 1 2 2 2) (country 2) (level 56) (wear 1) (limit archer 56) (range 176) (buy 0) (sell 1) (endurance 30) (maxprotect 150) (specialty (aspeed 700)   (Str 1) (Dex 4) (Attack 172 232) (hp 150) (mp 50) (hit 72)))

谢谢

4

1 回答 1

1

如果bow总是会在specialty此之前使用:

Find what:     (.*bow.*)(specialty)
Replace with:  $1specialty (aspeed 700)

如果bow以后出现,specialty使用两个正则表达式可能最容易做到这一点,上面的一个和这个:

Find what:     (specialty)(.*bow.*)
Replace with:  specialty (aspeed 700)$2

如果您是铁杆,那么您可能可以将这两个正则表达式结合起来,我现在可以想办法做到这一点:)

PS 旧版本的 Notepad++ 存在正则表达式问题。获取最新版本(撰写本文时为 6.3)以确保您没有问题。

于 2013-03-09T03:22:17.237 回答