1

Lets say I have a field which accepts A-Z,a-z,0-9 . If I'm trying to communicate to someone, via documenation or api creation "what" my code can accept, i HAVE to say:

A-Z,a-z,0-9

Now that in my mind this is restrictive and error prone.

Compare that to what i'm proposing.

Suppose A-Z,a-z,0-9 was allocated the "code" ANSI456

When I'm communicating that to someone, I can say that my code accepts ANSI456. If someone else was developing a check, there is no confusion on what my code can or cannot accept.

To those who will suggest just specifying character ranges, please note that what i'm envisioning will handle scenarios where even this is defined as a valid "code"

0-9, +, -, *, /

In fact, if its done properly, we can have a site generate automatic code in various languages to accomodate the different "codes".

Okay - i KNOW there are ~ infinite values, eg:

a-z      

is different from

a-l,n-z

And these would have two different codes in this "system".

I'm not proposing a HUMAN moderated system - it can be completely automatic BUT systematic way of generating these "codes"

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
siliconpi
  • 8,105
  • 18
  • 69
  • 107
  • What would be the use case? The number of places where "A-Z,a-z,0-9" or any similarly restricted number of characters is accepted is very limited these days. Thanks to internationalization you'll usually have to accept a much wider range than this. And **if** you have such a limited set, then specifying it the way you did (`A-Z,a-z,0-9`) seems perfectly fine to me. – Joachim Sauer May 04 '11 at 10:15
  • Okay - how do you validate a first name? – siliconpi May 04 '11 at 11:04
  • (just asking out of curiousity, not being cocky) – siliconpi May 04 '11 at 11:10
  • Certainly not using one of those sets. Günther won't be happy. Neither will André. Or people from China or arab-language countries. [This Question](http://stackoverflow.com/questions/421046/what-are-all-of-the-allowable-characters-for-peoples-names) handles this specific problem. – Joachim Sauer May 04 '11 at 11:38

1 Answers1

0

There already is such a standard, although it doesn't have the word "standard" in its name. It is called Perl 5 compatible regular expressions, and it is used in Perl 5, Java, JavaScript, libpcre and many other contexts.

Roland Illig
  • 40,703
  • 10
  • 88
  • 121