php中的正则表达式
下面给出的表达式可以用来匹配什么php中的正则表达式,php,Php,下面给出的表达式可以用来匹配什么 ([0123][0-9])-([01][0-9])-([0-9]{4}) 此外,它可以是社会保险号码、电子邮件、日期时间等这可以匹配给定的正则表达式 把这个表达分解一下: ([0123] -- Match 0 .. 3 [0-9]) -- Match 0 .. 9 - -- Match a dash ([01] -- Match a 0 or a 1 [0-9]) -- Match 0 .. 9 -
([0123][0-9])-([01][0-9])-([0-9]{4})
此外,它可以是社会保险号码、电子邮件、日期时间等这可以匹配给定的正则表达式 把这个表达分解一下:
([0123] -- Match 0 .. 3
[0-9]) -- Match 0 .. 9
- -- Match a dash
([01] -- Match a 0 or a 1
[0-9]) -- Match 0 .. 9
- -- Match dash
([0-9]{4}) -- Match 4 numbers in the range of 0 .. 9
至于圆括号,它们只捕获其中的表达式,即
([0123][0-9])
将捕获前两个匹配项 我之前提到过它有多棒:
尝试在这个网站上可能重复的商业广告删除;P这里的自由选择:@mario-真的吗?删除指向有价值的开发人员工具的链接?基于这种想法,我们应该删除所有与Visual Studio的链接,并将Mono Develop作为替代方案嗯,人们仍然可以用谷歌搜索它。没关系,我也想过盗版它,哈哈,因为它不像“监管者”那样在Linux/Wine下运行。但不管怎样,因为我们有一个很好的参考页,我认为这对普通读者来说更有趣。
([0123][0-9])-([01][0-9])-([0-9]{4})
Match the regular expression below and capture its match into backreference number 1 «([0123][0-9])»
Match a single character present in the list “0123” «[0123]»
Match a single character in the range between “0” and “9” «[0-9]»
Match the character “-” literally «-»
Match the regular expression below and capture its match into backreference number 2 «([01][0-9])»
Match a single character present in the list “01” «[01]»
Match a single character in the range between “0” and “9” «[0-9]»
Match the character “-” literally «-»
Match the regular expression below and capture its match into backreference number 3 «([0-9]{4})»
Match a single character in the range between “0” and “9” «[0-9]{4}»
Exactly 4 times «{4}»
Created with RegexBuddy