Character classes begin with [ and end first ] .
Thus, the expression [][] is a character class with characters ] and [ , since character classes should not be empty: [ ][ ]
And the expression [[]] is a character class with just [ and a single character ] after that: [ [ ] ]
source share