in reply to Re^2: Why would one want in a regex a class with only a single entry?
in thread Why would one want in a regex a class with only a single entry?

That doesn't bother me. The OP seemed to be discussing the validity and practicality of single-entry character classes. And I believe he was discussing them in the context of the [....] operator in a regexp. The backslash CC's and property CC's are already 'single entry', so probably not really so relevant to the discussion, particularly where they can stand-alone outside of a user-defined character class.

Certainly the POSIX classes constitute "single entries". And that's definitely another good argument for why single-entry character classes are practical, and should be legal (which, of course, they are).

The negated character class of a single entry just happened to be the first example that jumped to my mind. Your POSIX thought is great too.


Dave

  • Comment on Re^3: Why would one want in a regex a class with only a single entry?
  • Download Code

Replies are listed 'Best First'.
Re^4: Why would one want in a regex a class with only a single entry?
by parv (Parson) on Mar 25, 2008 at 08:59 UTC
    Thanks for your response, as I was trying to clarify, to self, just what makes a "single entry class". I was thinking strictly of a character class without any meta characters.
Re^4: Why would one want in a regex a class with only a single entry?
by ack (Deacon) on Mar 26, 2008 at 03:54 UTC

    davido and pary, thanks. davido you're correct...I was checking not so much on the validity of a single entry class (I know it's legal). I was just curious about why a programmer might want to have a single character class. pary made me think and realize, much like you're note of the negated class, that there are meta-character situations where a single entry could be usefule, too.

    Thanks to you both. I appreciate your insights.

    ack Albuquerque, NM