> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bash Character Class

A **bracket expression** is a pattern matching construct enclosed in square brackets (`[...]`) that matches exactly one character from a specified set. Within a bracket expression, a **character class** specifically refers to a named, locale-aware set of characters enclosed in `[:` and `:]`.

## Literal Sets and Ranges

A standard bracket expression matches any single literal character listed within the brackets. Ranges define a contiguous sequence of characters using a hyphen (`-`), determined by the collating order of the current locale.

```bash theme={"dark"}
[abc]
[a-z]
[a-zA-Z0-9_]
```

## Complementation (Negation)

A bracket expression is negated by placing an exclamation mark (`!`) or a caret (`^`) immediately after the opening bracket. This matches any single character *not* specified in the set. In standard Bash globbing, `!` is the POSIX-compliant negation operator, while `^` is typically used in regular expression contexts.

```bash theme={"dark"}
[!abc]
[^0-9]
```

## Character Classes

A character class is a predefined set of characters denoted by `[:classname:]`. Because character classes are locale-dependent, they match characters based on the system's linguistic rules rather than strict ASCII values. In a UTF-8 environment, a class like `[:alpha:]` will match accented characters (e.g., `é` or `ñ`), whereas a literal range like `[a-zA-Z]` may not. A character class must be nested inside a bracket expression to function.

```bash theme={"dark"}
[[:digit:]]
[[:lower:][:upper:]]
[![:space:]]
```

**Standard POSIX Classes:**

* `[:alnum:]`: Alphanumeric characters.
* `[:alpha:]`: Alphabetic characters.
* `[:blank:]`: Space and tab characters.
* `[:cntrl:]`: Control characters.
* `[:digit:]`: Decimal digits.
* `[:graph:]`: Printable characters excluding space.
* `[:lower:]`: Lowercase alphabetic characters.
* `[:print:]`: Printable characters including space.
* `[:punct:]`: Punctuation characters.
* `[:space:]`: Whitespace characters (space, tab, newline, carriage return, form feed, vertical tab).
* `[:upper:]`: Uppercase alphabetic characters.
* `[:xdigit:]`: Hexadecimal digits.

**Bash Extensions:**

* `[:ascii:]`: ASCII characters (range `0-127`).
* `[:word:]`: Alphanumeric characters plus underscore.

## Equivalence Classes

An equivalence class is denoted by `[=c=]` and matches all characters that share the same base collation weight as the character `c` according to the current locale. This is used to group a base letter with its accented variants.

```bash theme={"dark"}
[[=e=]]
```

*(Matches `e`, `é`, `è`, `ê`, etc., depending on the locale.)*

## Collating Symbols

A collating symbol is denoted by `[.symbol.]` and is used to match multi-character collating elements as a single entity within a bracket expression. This supports languages where two characters are treated as a single sorting unit (e.g., `ch` or `ll` in traditional Spanish collation).

```bash theme={"dark"}
[[.ch.]]
```

## Special Character Placement Rules

To match characters that normally hold syntactic meaning within a bracket expression (`]`, `-`, `!`, `^`), they must be placed in specific positions to force literal interpretation:

* **Closing Bracket (`]`):** Must be the first character in the set (or immediately following the negation operator).

```bash theme={"dark"}
[][]     # Matches ']' or '['
[!]]     # Matches any character except ']'
```

* **Hyphen (`-`):** Must be the first or last character in the set to avoid being interpreted as a range operator.

```bash theme={"dark"}
[-abc]   # Matches '-', 'a', 'b', or 'c'
[abc-]   # Matches 'a', 'b', 'c', or '-'
```

* **Exclamation/Caret (`!`, `^`):** Must be placed anywhere *except* the first position to be treated as literal characters.

```bash theme={"dark"}
[a!b^]   # Matches 'a', '!', 'b', or '^'
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Bash Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
