Bracket

Updated: 05/16/2020 by Computer Hope
Brackets

Sometimes referred to as square brackets, a bracket is a punctuation mark found in pairs. There are two types of brackets: the open bracket [ and the closed bracket ]. The open bracket has an open end towards the right, and the closed bracket has an open end towards the left. Brackets are the two keys found to the right of the P key on a US QWERTY keyboard.

Where are the square bracket keys on the keyboard?

Below is an overview of a computer keyboard with the open square bracket and close bracket keys highlighted in blue.

Bracket key

How to create an open and close square bracket

Creating the "[" and "]" symbols on a U.S. keyboard

On English keyboards, the open bracket and close bracket are on the same key as the curly bracket keys close to the Enter key. Pressing the open or close bracket key creates an open or bracket.

Note

Pressing and holding the Shift while pressing the [ key creates a curly bracket.

Creating the "[" and "]" symbol on a smartphone or tablet

To create a square bracket on a smartphone or tablet, open the keyboard, go into the numbers (123), then (#+=) or symbols (sym), and tap the "[" or "]" symbol.

How are brackets used?

  • Basic textual manner to add additional or missing details ("It was a honor to do it [the presentation].")
  • Regular expressions, wildcards, SQL, Visual Basic, C#, and JavaScript programming languages to enclose characters for string validation, pattern matching, or build arrays.
  • Used in standard mathematical notation for intervals and floor functions, and in the Lie bracket and Iverson bracket.

Regular expression bracket example

$value = s/[a-z]/-/ig;

This example replaces any character 'a' through 'z' in the $value variable with a hyphen.

JavaScript programming bracket example

var myList = new Array();
myList[0] = "value1";
myList[1] = "value2";
myList[2] = "value3";

SQL programming bracket example

SELECT name
FROM customers
WHERE name LIKE '[M-Z]inger'

What are the other symbols on the bracket keys?

On U.S. keyboards, the square bracket keys are shared with the curly bracket keys, which may be shown next to or above the square bracket symbols.

Curly bracket, Keyboard terms, Programming terms, SSD mounting bracket