标准化“字符集范围”作为国际定义的价值观
假设我有一个接受 AZ,az,0-9 的字段。如果我试图通过文档或 api 创建“我的代码可以接受什么”来与某人沟通,我必须说:
A-Z,a-z,0-9
现在在我看来,这是限制性的并且容易出错。
将其与我的建议进行比较。
假设 AZ,az,0-9 被分配了“代码”ANSI456
当我与某人沟通时,我可以说我的代码接受 ANSI456。如果其他人正在开发检查,那么我的代码可以接受或不能接受什么就不会产生混淆。
对于那些建议只指定字符范围的人,请注意,我设想的将处理甚至将其定义为有效“代码”的场景。
0-9, +, -, *, /
事实上,如果做得正确,我们可以生成一个站点 /em> 各种语言的自动编码以适应不同的“代码”。
好吧 - 我知道有〜无限的值,例如:
a-z
不同于
a-l,n-z
并且这些在这个“系统”中会有两个不同的代码。
我并不是在提议一个人工调节的系统 - 它可以是完全自动的,而是生成这些“代码”的系统方法
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"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已经有了这样一个标准,尽管它的名称中没有“标准”一词。它被称为 Perl 5 兼容正则表达式,并且用于 Perl 5、Java、JavaScript、libpcre 和许多其他上下文中。
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.