> For the complete documentation index, see [llms.txt](https://docs.wproofreader.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wproofreader.com/v6.12.0/api-reference/style-guide-api/validation-and-limits.md).

# Validation & limits

These constraints apply to `patterns`, `suggestions`, `context_include`, `context_exclude`, and `description`.

### Forbidden characters

Forbidden characters are validated per-field.

| Field(s)                                                        | Forbidden characters                                                                       | Notes                                            |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------ |
| `patterns`, `suggestions`, `context_include`, `context_exclude` | `#` `;` `[` `]` `<` `>` `{` `}` and control characters: `\n` `\t` `\b` `\r` `\a` `\f` `\v` | Control characters are rejected even if escaped. |
| `description`                                                   | `#` `[` `]` `<` `>` `{` `}` and control characters: `\n` `\t` `\b` `\r` `\a` `\f` `\v`     | Same as above, but `;` is allowed.               |

### Allowed characters

Allowed characters are validated per-field. All the not-lister characters are forbidden.

| Field(s)                       | Allowed characters                                                                                                                    | Notes |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| `collection`, `new_collection` | <p><code>\[a-z]</code>; <code>\[A-Z]</code>; <code>\[0-9]</code> ;<br><code>’ ‘</code> (space);<br><code>‘-’</code> (HyphenMinus)</p> |       |

### Length limits

Limits are Unicode character count.

The limit is the **total length across all values** when the field is an array.

| Field                          | Max length (Unicode chars) | Notes                                                |
| ------------------------------ | -------------------------- | ---------------------------------------------------- |
| `patterns`                     | 150                        | If this is an array, sum of all items must be ≤ 150. |
| `suggestions`                  | 150                        | If this is an array, sum of all items must be ≤ 150. |
| `context_include`              | 150                        | If this is an array, sum of all items must be ≤ 150. |
| `context_exclude`              | 150                        | If this is an array, sum of all items must be ≤ 150. |
| `description`                  | 200                        | Always checked as a single string.                   |
| `collection`, `new_collection` | 250                        | Always checked as a single string.                   |

### Uniqueness and cross-field rules

| Constraint                                | What it means                                                                                            |
| ----------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| Unique `patterns`                         | All `patterns` values must be unique within a rule.                                                      |
| Unique `suggestions`                      | All `suggestions` values must be unique within a rule.                                                   |
| Pattern vs suggestion collision           | A `patterns` value cannot equal any `suggestions` value.                                                 |
| Context vs pattern collision (`include`)  | No `context_include` item may equal any `patterns` item.                                                 |
| Context vs pattern collision (`exclude`)  | No `context_exclude` item may equal any `patterns` item.                                                 |
| Include vs exclude collision              | No `context_exclude` item may equal any `context_include` item.                                          |
| No substring overlap in `context_include` | No `context_include` value may be a substring of another `context_include` value.                        |
| No substring overlap in `context_exclude` | No `context_exclude` value may be a substring of another `context_exclude` value.                        |
| Rule-level duplication in a file          | Two rules with the same `patterns` + `context_include` combination are not allowed within the same file. |
| Unique `collection`,`new_collection`      | `collection` must be case-insensitive unique name per language.                                          |

### Limits

| Limit                      | Value     |
| -------------------------- | --------- |
| Maximum rules per language | **2,000** |
