admin管理员组文章数量:1332872
I ran into this RegExp /[[0]]/
in JavaScript, and have been wondering what it means.
I know that the outer pair of []
should be use as a character class, but what about the inner pair? I searched in Google and found this link, but "Collating Sequences" doesn't seem to be it 'cuz I can't get /[[.some.]]/
work as this page claims.
Thanks in advance if anyone can give me a hint.
I ran into this RegExp /[[0]]/
in JavaScript, and have been wondering what it means.
I know that the outer pair of []
should be use as a character class, but what about the inner pair? I searched in Google and found this link, but "Collating Sequences" doesn't seem to be it 'cuz I can't get /[[.some.]]/
work as this page claims.
Thanks in advance if anyone can give me a hint.
Share Improve this question edited Apr 1, 2012 at 16:59 Rob W 349k87 gold badges807 silver badges682 bronze badges asked Apr 1, 2012 at 15:14 OpenGGOpenGG 4,5602 gold badges25 silver badges32 bronze badges 1-
The website says:
I do not know of any regular expression engine that support collating sequences, other than POSIX-pliant engines part of a POSIX-pliant system.
Maybe thats why it isn't working? – Johannes Egger Commented Apr 1, 2012 at 15:21
1 Answer
Reset to default 11/[[0]]/
is equivalent to:
- A
[
or0
character, followed by a]
character.- Valid matches are:
[]
0]
- Invalid matches:
[0
- Valid string, but probably not an expected match:
[0]
(matches0]
)
- Valid matches are:
In other words: /(\[|0)\]/
or /[\[0]\]/
In real words: ( [ or 0 ) plus ]
.
本文标签: javascriptWhat does double square bracketsmean in a regexStack Overflow
版权声明:本文标题:javascript - What does double square brackets [[]] mean in a regex? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742305224a2449780.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论