] (Right Square Bracket) is ASCII code point 93 (0x5D), Unicode U+005D, and a printable punctuation character. It closes what [ opened — the editorial aside, the bracketed insertion, the contained thought — snapping the fence shut and returning the reader to the surrounding text. In code, ] appears at the end of every array access, every slice operation, every character class in a regex, and every JSON array. It's the character your eye hunts for when trying to figure out where a deeply nested data structure finally bottoms out. Python's list comprehensions lean heavily on the pair, and a complex comprehension like [x for x in [y for y in range(10)] if x > 3] demands careful bracket-counting to parse visually. In Markdown, ] plays a structural role in link syntax: [text](url) uses the right bracket to close the display text before the parenthesized URL. The real-world trap with this character lives inside regular expressions: placing ] inside a character class requires it to appear first — []abc] matches ], a, b, or c — because anywhere else the engine reads it as closing the class. Most developers don't discover this rule until their character class silently stops matching at the wrong position and the rest of their pattern falls apart. Like its opening partner, the right square bracket emerged in seventeenth-century printing as a companion glyph, the two always designed and cast as a matched set. UTF-8 encodes it as a single byte 0x5D. Unicode classifies it as Pe (Punctuation, Close) with the name RIGHT SQUARE BRACKET. Its fullwidth variant ] (U+FF3D) exists for CJK typesetting, and the mathematical right angle bracket ⟩ (U+27E9) is a taller, thinner glyph used in physics notation — similar in spirit but a different character in every meaningful way.
int a[3] = {10, 20, 30};int i = 1;int v = a[i]; // index access uses ]char c = ']'; // ASCII 93 literal
Mostly no — ] almost always closes a matching [. The main exception is in Bash, where ] is a required argument to the [ (test) command: [ -f file ] literally calls 'test' with '-f', 'file', and ']' as arguments. In regex, ] closes character classes.
The bracket syntax comes from early wiki markup. [text] visually 'boxes' the visible label, and (url) groups the target separately. It's readable in plain text, easy to parse, and the brackets suggest 'this is a reference.' This design influenced many documentation formats.
Place ] immediately after the opening [ or [^: []abc] matches ], a, b, or c. Alternatively, escape it: [a\]b] matches a, ], or b. This positioning trick works because the regex engine treats ] as the end of the class only when it's not the first character.
[] for arrays and indexing (most languages). {} for objects and blocks. () for function calls and grouping. <> for generics and HTML. These conventions are so ingrained that mixing them (like using {} for arrays) would confuse virtually every programmer.