Corner quotes in Unicode

In his book Mastering Regular Expressions, Jeffrey Friedl uses corner quotes to delimit regular expressions. Here’s an example I found by opening his book a random:

    ⌜(\.\d\d[1-9]?)\d*⌟

The upper-left corner at the beginning and the lower-right corner at the end are not part of the regular expression. This particularly comes in handy if a regular expression begins or ends with white space.

(It wouldn’t do to, say, use quotation marks because this would invite confusion between the regular expression itself and a quoted string used to express that regular expression in a programming language.)

I’ve thought about using Friedl’s convention but I didn’t think it could be done with plain text. It can, using Unicode character U+231C at the beginning and U+231D at the end.

There are four corner quotes:

    |------+--------+---------------------|
    | Char | Code   | Name                |
    |------+--------+---------------------|
    | ⌜    | U+231C | TOP LEFT CORNER     |
    | ⌝    | U+231D | TOP RIGHT CORNER    |
    | ⌞    | U+231E | BOTTOM LEFT CORNER  |
    | ⌟    | U+231F | BOTTOM RIGHT CORNER |
    |------+--------+---------------------|

Corner quotes are also used in logic to denote Gödel numbers, e.g. ⌜φ⌝ denotes the Gödel number for φ.

Corner quotes are also known as Quine quotes. They usually come in the pair top left and top right, rather than top left and bottom right as in Friedl’s usage.

Update: As Rob Wells points out in the comments, it seems Friedl used CJK quote marks 「 (U+300C) and 」 (U+300D) rather than the corner quotes, which makes sense given that Friedl speaks Japanese.

Related posts

6 thoughts on “Corner quotes in Unicode

  1. I prefer the undertie “‿” (U+203F) for whitespace, because it’s easy to replace.

    But now I want to use corner quotes just to be edgy and cool.

  2. Thanks for this John, I’d forgotten about this neat usage in the Friedl book.

    I think though that the characters in the book are not the corner symbols from U+231C on but rather the left and right corner bracket from the “CJK symbols and punctuation” section, U+300C and U+300D, 「like so」.

    Here’s the Unicode character info page for the left bracket: https://util.unicode.org/UnicodeJsps/character.jsp?a=300C

  3. You see corner quotes used in Japanese a bit (not that common) and they’re easy to input using an IME. In mine (Mac), typing [ gives「, and ] gives 」.

  4. I find it amusing (possibly I’m the only one) that this blog post contains a table rendered using typographical characters to present a list of typographical characters. However, the typographical characters included in the list (the four corner symbols) are not used for the purpose which they are the most eminently suited: to represent the corners of the table itself.

Comments are closed.