> For the complete documentation index, see [llms.txt](https://prosbcdocs.telcobridges.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://prosbcdocs.telcobridges.com/configuration-details/configuration-by-web-portal-category/call-routing/how-to-use-regex-in-remapped-called-and-calling-number-mask/regular-expression-quick-start-guide.md).

# Regular expression quick start guide

### Quick Reference Table<br>

| Regular Expression Pattern    | Explanations                                                                                                                                                                                                                     | <p>Examples<br></p>                                                                                                    |             |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----------- |
| <p>Meta characters  \[^$.     | ?\*+(<br></p>                                                                                                                                                                                                                    | <p>Special caracters used in regex.</p><ul><li>Must be escape with backslash "" to use a literal characters.</li></ul> | <p><br></p> |
| <p>Literal characters<br></p> | <p>All characters (except the metacharacters) match a single instance of themselves.<br></p><ul><li>{ and } are literal characters, unless they're part of a valid regular expression token (e.g. the {n} quantifier).</li></ul> | <p><em>/a/</em> matches "a"<br></p>                                                                                    |             |
| <p>\[characters]<br></p>      | <p>Character classes or character set. A character class matches a single character out of all the possibilities offered by the character class.<br></p>                                                                         | <p><em>/\[0-9]/</em> matches a single digit<br></p>                                                                    |             |
| <p>\[\d]<br></p>              | <p>Shorthand character classes matching digits. Same as \[0-9].<br></p>                                                                                                                                                          | <p><em>/\[\d]/</em> matches a single digit<br></p>                                                                     |             |
| <p>.<br></p>                  | <p>Dot matches any characters.<br></p>                                                                                                                                                                                           | <p><em>/a.c/</em> matches both "a4c" and "ayc"<br></p>                                                                 |             |
| ^                             | Matches at the start of the string the regex pattern is applied to. Matches a position rather than a character.                                                                                                                  | <p><br></p>                                                                                                            |             |
| $                             | Matches at the end of the string the regex pattern is applied to. Matches a position rather than a character.                                                                                                                    | <p><br></p>                                                                                                            |             |
| <p>{m,n}<br></p>              | <p>Matches at least “m” and at most “n” occurrences of preceeding character, character class or group.<br></p>                                                                                                                   | <p><br></p>                                                                                                            |             |
| \*                            | Matches zero or more occurrences of preceeding character, character class or group.                                                                                                                                              | <p><br></p>                                                                                                            |             |
| +                             | <p>Matches one or more occurrences of preceeding character, character class or group.<br></p>                                                                                                                                    | <p><br></p>                                                                                                            |             |
| ?                             | Matches zero or one occurrences of  preceeding character, character class or group.                                                                                                                                              | <p><br></p>                                                                                                            |             |
| ()                            | <p>Parentheses are used for group or capturing group<br></p>                                                                                                                                                                     | <p><br></p>                                                                                                            |             |
| \0, \1, \2, ...               | Substitute the value matched by the nth grouped sub-expression, used in remapped fields.                                                                                                                                         | <p><br></p>                                                                                                            |             |
| ?!                            | Not, as in "everything except this".                                                                                                                                                                                             | <p><br></p>                                                                                                            |             |

\
Examples<br>

Here are some examples:

Add 2720 prefix:

```
/^(\d+)$/2720\1/
```

or

```
/^([0-9]*)$/2720\1/
```

Strip first 4 digits:

```
/^([0-9]{4})([0-9]*)$/\2/
```

Strip # and 7 first digits:

```
/^([#])([0-9]{7})([0-9]*)$/\3/
```

### Web Online Tools

* Regular builder tool (with replace)  : [www.gskinner.com/RegExr](http://www.gskinner.com/RegExr)

Tips to use:

1. No need to enclose the Regular expression with '/'.
2. Replace : the regular expression must be split in two parts and '\\' replaced by '$'. For example, with '/^(\[0-9]\*)$/2720\1/', the '^(\[0-9]\*)$' would be filled on the first line and '2720$1' on the second line.

* Ruby regular expression editor and tester : [rubular.com](http://rubular.com/)<br>

### References

* [How to Use RegEx in Remapped Called and Calling Number Mask](https://docs.telcobridges.com/wiki/Toolpack:_How_to_Use_RegEx_in_Remapped_Called_and_Calling_Number_Mask)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://prosbcdocs.telcobridges.com/configuration-details/configuration-by-web-portal-category/call-routing/how-to-use-regex-in-remapped-called-and-calling-number-mask/regular-expression-quick-start-guide.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
