正则表达式。 [英] Regular expression pattern.
问题描述
大家好,
请解释下面的正则表达式模式。它允许的是什么字符。
这里的'*'是什么?
< xsd:complexType name = NAMETYPE >
< xsd:sequence>
< xsd:element name =FirstName>
< xsd:simpleType>
< xsd:restriction base =xsd:string>
< xsd:maxLength value =16/>
< xsd:pattern value =([A-Za-z0-9'\-]?)* [A-Za-z0-9'\ - ]/>
< / xsd:restriction>
< / xsd:simpleType>
< / xsd:element>
< / xsd:sequence>
< / xsd:complexType>
请指导我如何理解[A-Za-z0-9'\\ \\ - ]?)* [A-Za-z0-9'\-]模式。
我尝试了什么:
根据我的假设,它允许AZ,az,0-9和空格字符,如反斜杠,
单引号和连字符。
Regexper [ ^ ]
< blockquote>
Quote:根据我的假设,它允许AZ,az,0-9和空格字符,如反斜杠,
单引号和连字符。
您的RegEx比这更复杂,看起来您的问题是您在没有真正学习的情况下使用RegEx。
使用上一个链接并粘贴RegEx,你会看到一个漂亮的RegEx图表,希望它可以帮助你理解它。
只是一些有趣的链接来帮助构建和调试RegEx。 />
以下是RegEx文档的链接:
perlre - perldoc.perl.org [ ^ ]
这里是帮助构建RegEx并调试它们的工具的链接:
.NET正则表达式测试程序 - 正则表达式风暴 [ ^ ]
快速正则表达式工具 [ ^ ]
这个显示RegEx是一个很好的图表,它非常有助于理解RegEx的作用:
Debuggex:在线可视正则表达式测试器。 JavaScript,Python和PCRE。 [ ^ ]
Hi Everyone,
Please explain the below regular expression pattern. What characters it allows.
And what is '*' here ?
<xsd:complexType name="NameType"> <xsd:sequence> <xsd:element name="FirstName"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="16"/> <xsd:pattern value="([A-Za-z0-9'\-] ?)*[A-Za-z0-9'\-]"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType>
Please guide me how to understand [A-Za-z0-9'\-] ?)*[A-Za-z0-9'\-] pattern.
What I have tried:
As per my assumption it allows A-Z, a-z ,0-9 and spacial characters like Back slash,
Single Quote, and Hyphen.
Regexper[^]
Quote:As per my assumption it allows A-Z, a-z ,0-9 and spacial characters like Back slash,
Single Quote, and Hyphen.
Your RegEx is a little more complex than that, looks like your problem is that you use RegEx without really learning it.
Use last link and paste the RegEx and you will see a nice graph of your RegEx, hope it helps you to understand it.
Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
这篇关于正则表达式。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!