> For the complete documentation index, see [llms.txt](https://upsolver.gitbook.io/content/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://upsolver.gitbook.io/content/reference-1/functions-and-operators/functions/regular-expressions.md).

# Regular Expressions

This section describes the following regular expression functions:

<table><thead><tr><th width="298">Function</th><th>Description</th></tr></thead><tbody><tr><td><a href="/pages/ixoDAv0wybpLiU9sZ94f">REGEX_EXTRACT</a></td><td>Finds the first match of the regular expression pattern in string and returns the capturing group number requested</td></tr><tr><td><a href="/pages/gnNlPazM19h0kVfc6oaY">REGEXP_EXTRACT_ALL</a></td><td>Matches the regular expression on the input string. Returns the escape groups if any exist or the original string if none exists</td></tr><tr><td><a href="/pages/wZInCY9q3bsM7doR4hfa">REGEXP_LIKE</a></td><td>Evaluates the regular expression pattern and determines if it is contained within the string</td></tr><tr><td><a href="/pages/GighMTLQEISQhMkrdjji">REGEX_MATCH_POSITION</a></td><td>Matches the regular expression on the input string, and returns the index of the first match</td></tr><tr><td><a href="/pages/qehipMexGB2rB1hQmIhq">REGEX_NAMED_GROUPS</a></td><td>Matches the regular expression on the input string. Returns record with field names and group names</td></tr><tr><td><a href="/pages/NMa2YZNEGbG8ZuA8Ovct">REGEXP_REPLACE</a></td><td>Evaluates the regular expression pattern and replaces every instance found with the replacement</td></tr></tbody></table>

## Regular expression patterns

The regular expression patterns used when performing RegEx pattern matches are described in the table below:

<table><thead><tr><th width="247.71930997322397">Expression</th><th width="150">Contact</th><th>Description</th></tr></thead><tbody><tr><td>Any character</td><td>.</td><td>Matches any single character except a line break.</td></tr><tr><td>Zero or more</td><td>*</td><td>Matches zero or more occurrences of the preceding expression, making all possible matches.</td></tr><tr><td>One or more</td><td>+</td><td>Matches at least one occurrence of the preceding expression.</td></tr><tr><td>Beginning of line </td><td>^ </td><td>Anchors the match string to the beginning of a line.</td></tr><tr><td>End of line</td><td>$ </td><td>Anchors the match string to the end of a line.</td></tr><tr><td>Beginning of word </td><td>&#x3C;</td><td>Matches only when a word begins at this point in the text.</td></tr><tr><td>End of word</td><td>></td><td>Matches only when a word ends at this point in the text.</td></tr><tr><td>Line break</td><td>\n </td><td>Matches a platform-independent line break. In a Replace expression, inserts a line break.</td></tr><tr><td>Digits</td><td>\d</td><td>Matches any digit [0-9].</td></tr><tr><td>Any one character in the set </td><td>[] </td><td>Matches any one of the characters within the []. To specify a range of characters, list the starting and ending character separated by a dash (-), as in [a-z].</td></tr><tr><td>Matches any character not in the set of characters following the ^.</td><td>[^...] </td><td>Matches any character not in the set of characters following the ^.</td></tr><tr><td>Or</td><td>|</td><td>Matches either the expression before or the one after the OR symbol (|). Mostly used within a group. For example, (sponge|mud) bath matches "sponge bath" and "mud bath."</td></tr><tr><td>Tagged expression</td><td>{} </td><td>Matches text tagged with the enclosed expression.</td></tr><tr><td>/C++ Identifier</td><td>:i </td><td>Matches the expression ([a-zA-Z_$][a-zA-Z0-9_$]*).</td></tr><tr><td>Quoted string</td><td>:q</td><td>Matches the expression (("[^"]<em>")|('[^']</em>')).</td></tr><tr><td>Space or Tab</td><td>:b</td><td>Matches either space or tab characters.</td></tr><tr><td>Matches the expression ([0-9]+).</td><td>:z</td><td>Integer :z Matches the expression ([0-9]+).</td></tr></tbody></table>


---

# 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://upsolver.gitbook.io/content/reference-1/functions-and-operators/functions/regular-expressions.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.
