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.
/[[0]]/
is equivalent to:
[
or 0
character, followed by a ]
character.
[]
0]
[0
[0]
(matches 0]
)In other words: /(\[|0)\]/
or /[\[0]\]/
In real words: ( [ or 0 ) plus ]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With