in reply to Re: Re: Re: Do nothing? or Do something important in a very obscure way?
in thread Do nothing? or Do something important in a very obscure way?

Precisely. Let's ignore the syntax and mechanics, and re-examine the question (just in case it's helpful):

A regex is a way to find something in something else. When building one, you have to consider carefully what it is you're trying to find, as well as where you're trying to find it.

The root of this confusion was, "Why would I want to find none of something?"

If you've got an irregular something to find, based around regular features, you would want to find none of the irregular (but expected) things, all of the regular features, and would want to be able to fail on unexpected irregularities.

Similarly, if you've got something you want to find "no matter what", you could try to find it with no whitespace or punctuation (so that "important" would be the same as "*important*" and "I!M!P!O!R!T!A!N!T" and suchlike).

These are probably bad examples, as I do not write complicated regexes myself, but I think the context is correct.
  • Comment on Re: Re: Re: Re: Do nothing? or Do something important in a very obscure way?