> 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/telecom-references/apis-and-integration/regular-expression.md).

# Regular Expression

### Introduction

R**egular expressions**, also referred to as \*\*regex \*\*or **regexp**, provides a concise and flexible means for matching strings of text, such as particular characters, words, or patterns of characters. A regular expression is written in a formal language that can be interpreted by a regular expression processor, a program that either serves as a parser generator or examines text and identifies parts that match the provided specification.

Regular expressions are extensively used in computing and is really powerful. You can think of regular expressions as wildcards on steroids. You are probably familiar with wildcard notations such as \**.txt* to find all text files in a file manager, the equivalent regex would be :

```
/.*\.txt$/
```

This section provides a quick reference.

### Definition

Regular expressions is the term used for a codified method of searching invented or defined by the American mathematician Stephen Kleene.

#### POSIX definition

Traditional Unix regular expression syntax followed common conventions but often differed from tool to tool. The IEEE POSIX 1003.2 Basic Regular Expressions (BRE) standard (released alongside an alternative flavor called Extended Regular Expressions or ERE) was designed mostly for backward compatibility with the traditional (Simple Regular Expression) syntax but provided a common standard which has since been adopted as the default syntax of many Unix regular expression tools, though there is often some variation or additional features.

#### Perl-derivative

Perl has a more consistent and richer syntax than the POSIX basic (BRE) and extended (ERE) regular expression standards. An example of its consistency is that \ always escapes a non-alphanumeric character. Another example of functionality possible with Perl but not POSIX-compliant regular expressions is the concept of lazy quantification (see the next section).

Due largely to its expressive power, many other utilities and programming languages have adopted syntax similar to Perl's — for example, Java, JavaScript, **PCRE**, Python, **Ruby**, Microsoft's .NET Framework, and the W3C's XML Schema all use regular expression syntax similar to Perl's.

### Toolpack and regular expressions

[Toolpack Application:gateway](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/concepts/gateway/README.md) makes use of Perl-derivative regular expressions for route matching and remapping (see [CallRouting](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/concepts/call-routing/README.md)).

The Gateway application make uses of:

* PCRE regex syntax for the base routing engine.
* Ruby regex syntax for the [Scriptable Routing Engine](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/concepts/scriptable-routing-engine/README.md).

***Note***: Both PCRE and Ruby syntax are compatible (Perl-derivative).

### Regular expression quick start guide

* [Regular expression quick start guide](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/api/regular-expression-quick-start-guide/README.md)

### References

[Regular Expression on Wikipedia](http://en.wikipedia.org/wiki/Regular_expression)

[www.regular-expressions.info/quickstart.html](http://www.regular-expressions.info/quickstart.html)


---

# 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/telecom-references/apis-and-integration/regular-expression.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.
