正则表达式模式以允许正整数和负整数 [英] regex pattern to allow positive and negative integers
本文介绍了正则表达式模式以允许正整数和负整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在 XSD 中找到允许正整数和负整数的正则表达式
I am trying to find regex pattern in XSD that allow both positive and negative integers
我当前的代码只允许正整数.
My current code allows only positive integers.
xs:pattern value="[0-9]{0,10}"
推荐答案
假设你只在数字前面提到一个可选的负号:
Assuming you only mention an optional negative sign in front of the number:
xs:pattern value="-?[0-9]{0,10}"
这篇关于正则表达式模式以允许正整数和负整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文