开发者

Standardizing "character set ranges" as internationally defined values

开发者 https://www.devze.com 2023-03-02 22:38 出处:网络
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:

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"


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消