How do I represent white space in a phrase on gatherer's advanced search? I read the help, and I've used regexes before, but I can't get this to work for me.

AND lifelink

NOT m/until\send\sof\turn/

NOT creature

Should give

AND lifelink

NOT until end of turn

NOT creature

I'm looking for cards that give lifelink as a persistent effect like enchantments or equipment.

What am i doing wrong with the regex? Why does it still show card with end of turn in the text body?

Edit: gatherer specifically instructs to use regex...


  • 1
    Can you clarify if you're looking for a way to search for a list of cards on Gatherer? If you are, then this is on-topic for the site. If you are writing a regex for use in some program you are writing, then you should just ask this at Stackoverflow.
    – GendoIkari
    May 19 '17 at 13:42
  • 2
    Is this about how to work regexes (in Java, maybe with a Gatherer API or something) or is it about using Gatherer's Search page? Seems like the latter, which ought to be within our domain. (Downvotes aren't ban votes, btw, don't know where you got that idea. You're at no risk of getting automatically question banned.) Is there a reason you're not just typing in "until end of turn" (with plain ordinary spaces)? May 19 '17 at 13:44
  • An alternative to using the web form to make regex is to put the regex directly into the url.
    – Mosquite
    May 19 '17 at 17:29
  • 2
    You're missing the 's' in between 'of' and 'turn'?
    – xornob
    May 19 '17 at 19:09
  • On their search page May 20 '17 at 1:51

It looks like the Gatherer search simply does not understand negated regular expressions. I tried, and it gives the exact same results with NOT <regular expression> as with AND <regular expression>.

Fortunately, your search does not require the use of regular expressions at all. You can find what you're looking for just by using NOT "until end of turn" instead.

  • You solved my problem, but i feel reluctant to accept it since it does not answer the question itself. Regex is powerful, and it would be amazing to be able to use it on gatherers search page. If it proves that it will not parse regex, you would have been the first to suggest it and i would accept. But a solution is not the purpose here. The WWW needs answers. =P May 20 '17 at 20:03
  • 1
    This does answer your question. You ask why your query isn't giving the results you expect. The answer is that Gatherer does not properly handle negated regular expressions. That doesn't mean that regular expressions don't work at all.
    – murgatroid99
    May 21 '17 at 1:06

You are representing whitespace properly. "\s" is a placeholder for "one whitespace character," but your search doesn't yield the expected results because, as has been stated before, gatherer doesn't properly negate regex search terms.

You can use a Negative Lookahead group combined with a single wildcard, repeated together, in order to check to make sure the specified phrase doesn't appear anywhere in the field. The regex for "cards that do not contain the text 'Until end of turn'" would be m/^((?!Until\send\sof\sturn).)*$/

The specific gatherer url for your query would be: http://gatherer.wizards.com/Pages/Search/Default.aspx?action=advanced&text=+[lifelink]+[m/^((?!Until\send\sof\sturn).)*$/]&type=+![%22Creature%22]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.