views:

41

answers:

3

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?

A: 

Can you do this?

s/true|false/!&/
strager
No, that won't work.
Ollie Saunders
@Saunders, Why not?
strager
Because TextMate is not sed.
Ollie Saunders
Then don't use TextMate...? Or find a plugin...?
Mark
I don’t know if the suggested replace works in `sed`, but if it does, can’t you simply filter the whole file through an external command?
zoul
A: 

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.

Rahul
That's what I ended-up doing. Not ideal though. I have to do this kind of thing from time to time so I'd like a faster option.
Ollie Saunders
+1  A: 

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

Bart Kiers