# Regular Expressions

{% hint style="info" %}
You can find the full description of RegExp in [Wikipedia](https://en.wikipedia.org/wiki/Regular_expression). This article will provide you with a short cheat sheet of frequently used expressions.
{% endhint %}

{% hint style="warning" %}
**No JS evaluation** is needed in regex! Just remember to use **'\*'** after the expression.
{% endhint %}

### `rexExp` cheat sheet

| Meta-character | Description                                                        |
| -------------- | ------------------------------------------------------------------ |
| `.`            | Matches any character                                              |
| `+`            | Matches the preceding pattern element one or more times.           |
| `?`            | Matches the preceding pattern element zero or one time.            |
| `\|`           | Separates alternate possibilities, `A\|B = A or B`                 |
| `^`            | Matches the beginning of a line or string.                         |
| `$`            | Matches the end of a line or string.                               |
| `[ ]`          | Denotes a set of possible character matches. `[ABC] = A or B or C` |
| `\`            | Escapes special characters                                         |

### Frequently used Regular Expressions

| Case                          | regExp (you can copy-paste them right into Directual)                                                   |
| ----------------------------- | ------------------------------------------------------------------------------------------------------- |
| Check email format            | `.+@.+\..*`                                                                                             |
| Check particular email domain | `.+@yourdomain\.com*`                                                                                   |
| Any digit number              | `[0-9]*`                                                                                                |
| Any latin character           | `[a-zA-Z]*`                                                                                             |
| Greetings                     | `.*hello\|hi\|good morning\|good evening\|salut.*`                                                      |
| URL                           | `https?:\/\/(www.)?[-a-zA-Z0-9@:%.`*`+~#=]{1,256}.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%`*`+.~#?&//=]*)` |

Useful service for composing a regular expression: [regex101.com](https://regex101.com/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://readme.directual.com/template-system/comparison-operators/regular-expressions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
