整数范围的 XML 模式正则表达式,不包括 0
我正在开发一个 XML 模式,我需要将整数限制在 -20 到 20 的范围内,但不是 0。
我打算将 minInclusive 和 maxInclusive 用于 -20 到 20。
我尝试添加正则表达式“=”^(?!0).+”,但这似乎不是有效的 XML 正则表达式。
我可以为 xs:pattern 输入什么值来防止整数为 0?
I'm developing an XML schema and I need to restrict an integer to being within a ranger of -20 to 20, but not 0.
I was going to use minInclusive and maxInclusive for the -20 to 20.
I tried to add the regex "="^(?!0).+", but that does not appear to be a valid XML regex.
What value can I put in for xs:pattern that will prevent an integer from being 0?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

您是否尝试过枚举合法值。可行,因为范围很小。
Have you tried enumerating the legal values. Workable since the range is quite small.