简体   繁体   English

如何在WSDL中为不以11开头的数字编写正则表达式

[英]how to write regex for number not starting with 11 in WSDL

I need a regular expression for WSDL, in which a number should not start with 11 . 我需要WSDL的正则表达式,其中的数字不应以11开头。 I'm using the following pattern but it is not working. 我正在使用以下模式,但无法正常工作。 The number is 4 digit and it should not start with 11. 数字是4位数字,不能以11开头。

<xsd:pattern value="(?!11)[0-9]{2}[0-9]{2}" />

Thanks in advance. 提前致谢。

How about the following regex: 下面的正则表达式如何:

((1[02-9])|([02-9]1)|([02-9][02-9]))[0-9][0-9]
  ^^^^^^^   ^^^^^^^   ^^^^^^^^^^^^  ^^^^^^^^^^
  AAAAAAA   BBBBBBB   CCCCCCCCCCCC  DDDDDDDDDD

What the partial expressions do: 部分表达式的作用:

  • AAA finds all two digit numbers starting with 1 and not having 1 as the second digit AAA查找以1开头但第二个数字不为1的所有两个数字
  • BBB finds all two digit numbers ending with 1 and not having 1 as the first digit BBB查找以1结尾但不以1作为第一位的所有两个数字
  • CCC finds all two digit numbers not containing the digit 1 at all CCC查找所有根本不包含数字1的所有两个数字
  • DDD adds two more digits 0..9 to make it a four digit number DDD再加上两位数字0..9 ,使其成为四位数

The pipe signs | 管道标志| between the expressions AAA and BBB and CCC function as a logical OR. 在表达式AAABBBCCC用作逻辑或。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM