2
A
回答
3
的/
是分隔符。
[a-z]
是character class(任何在AZ范围字符)
+
是前述图案的one-or-more times([a-z]
在这种情况下)
:
仅仅是结肠字面
它大致意味着“向前看,并确保没有字母字符后跟冒号“。
此正则表达式会更有意义,如果它有串锚的开始:/^(?![a-z]+:/
,所以它不会匹配abc:
(像其他答案之一说),但没有(^
)我不知道如何这是有用的。
2
:
Assert that it is impossible to match the regex below starting at this position (negative lookahead) «(?![a-z]+:)»
Match a single character in the range between “a” and “z” «[a-z]+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Match the character “:” literally «:»
0
(?!REGEX)
是negative lookahead的语法。检查链接以获取有关lookahead的解释。
如果模式[a-z]+:
出现在当前位置的字符串中,则该正则表达式失败。如果没有找到该模式,则正则表达式会成功,但不会消耗任何字符。
这将匹配123:
或abc
但不abc:
这将在abc:
匹配:
。
相关问题
- 1. 这个正则表达式在django中意味着什么?
- 2. 这个正则表达式在lex中意味着什么
- 3. 这在正则表达式中意味着什么?
- 4. [^ Z] +这在正则表达式(Python)中意味着什么?
- 5. 这个表达意味着什么“!!”
- 6. 这个表达意味着什么?
- 7. 这个表达意味着什么:“R.string.gcm_registered”?
- 8. $和*在PCRE(正则表达式)中意味着什么?
- 9. 逗号在我的正则表达式中意味着什么
- 10. 这个正则表达式语法在Java中意味着什么?
- 11. 正则表达式中的/意味着什么?
- 12. 什么“。”意味着在正则表达式
- 13. 这个拆分表达式在Perl中意味着什么?
- 14. 这个表达式在JavaScript中意味着什么?
- 15. $这意味着什么PHP?
- 16. 正则表达式(?<! - )意味着什么
- 17. _是什么?在以下正则表达式中意味着什么?
- 18. _ =>这在Lambda表达式中意味着什么?
- 19. 双正方括号[[]]在正则表达式中意味着什么?
- 20. 正则表达式的翻译,无法找到这意味着什么
- 21. 这个haskell表达式意味着什么
- 22. 这个表达式对ipfiltering项目意味着什么?
- 23. 这个Unicode字符(码点)在这个正则表达式中意味着什么?
- 24. 这个'&'在Ruby中意味着什么?
- 25. 这是什么头意味着在PHP
- 26. php中的这个正则表达式是什么意思?
- 27. 这个PHP正则表达式模式是什么意思?
- 28. 什么===在PHP意味着
- 29. 什么。意味着在PHP?
- 30. 这个表达意味着什么? (C中的SetConsoleTextAttribute函数)
不,这是[不正确。](http://rubular.com/r/sGqgeS5yPi)。它仍然匹配'abc:' – Aillyn 2010-08-27 04:49:17
@Aillyn我看不出在lookahead之前或之后如果没有某种模式,正则表达式会是有用的。 – Amarghosh 2010-08-27 04:54:00