> For the complete documentation index, see [llms.txt](https://docs.docbits.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docbits.com/administration-and-setup/settings/global-settings/document-types/regex/purpose-and-use.md).

# Purpose and use

Regex, short for "Regular Expressions", is an extremely powerful method for pattern recognition in texts. It allows you to search for specific strings or patterns within texts, offering a high level of flexibility and precision.

**In terms of data extraction from structured text formats such as documents, Regex plays a crucial role for several reasons:**

**Precise pattern recognition:**

* Regex allows you to define precise patterns for which text should be searched.
* This is particularly useful when the data to be extracted follows a specific format or structure.

**Flexible adaptation:**

* Since Regex offers a wide range of operators and constructs, complex patterns can be defined to extract data in different formats and variants.
* This allows for flexible adaptation to different document structures.

**Efficient processing:**

* Regex enables efficient processing of large amounts of text, since pattern searches are usually quick and even large text documents can be searched in an acceptable time.

**Automation:**

* Regex can be used in scripts and programs to automate the extraction process.
* This is especially useful when large volumes of documents need to be processed as extraction manually would be time-consuming and error-prone.

**Validation and Cleansing:**

* Apart from extracting data, Regex also allows validation and cleaning of texts.
* By defining patterns, unwanted strings can be identified and removed, resulting in cleaner and more consistent data.

Overall, using Regex provides an effective way to analyze structured text formats and extract data accurately and efficiently, which in turn is of great use for various applications such as data analysis, text processing, information extraction, and machine learning.


---

# 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://docs.docbits.com/administration-and-setup/settings/global-settings/document-types/regex/purpose-and-use.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.
