开发者

Cleanly translate (x to y) and (y to x) using a find/replace/regex in TextMate

开发者 https://www.devze.com 2022-12-08 08:11 出处:网络
I want to change this: _(with(new FuListNode )->isList())->shouldBe(true); _(with(new FuListNodes)->isList())->shouldBe(false);

I want to change this:

_(with(new FuListNode )->isList())->shouldBe(true);
_(with(new FuListNodes)->isList())->shouldBe(false);
_(with(new FuTreeNode )->isList())->shouldBe(true);
_(with(new FuTreeNodes)->isList())->shouldBe(false); } }

to this (look at the booleans at the end):

_(with(new FuListNode )->isList())->shouldBe(false);
_(with(new FuListNodes)->isList())->shouldBe(true);
_(with(new FuTreeNode )->isList())->shouldBe(false);
_(with(new FuTreeNodes)->开发者_开发百科;isList())->shouldBe(true); } }

I'm using TextMate, how can I do that cleanly with a single find/replace?


It can't be done using a single search and replace.


Can you do this?

s/true|false/!&/


I have never used TextMate but can you not do something like this ?

1. Replace all "true" with some dummy value, say "hello"
2. Replace all "false" with "true"
3. Replace all "hello" with "false"

Of course this involves 3 find-replaces and not 1 as you've requested.

0

精彩评论

暂无评论...
验证码 换一张
取 消