> For the complete documentation index, see [llms.txt](https://docs.coherent.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coherent.global/assistant/custom-functions/regexsearch.md).

# REGEXSEARCH

{% hint style="info" %}
This function is only available in Coherent Assistant and not implemented into [Neuron](/build-spark-services/neuron.md). Spark services created with this UDF will not include this functionality.
{% endhint %}

## Syntax

`CS.SPARK_REGEXSEARCH(find_regex, within_text, [start_num])`

* `find_regex`. Required. This argument represents the regular expression pattern you want to match within the 'text' argument. It should be a valid regular expression string.
* `within_text`. Required. This is the text string in which you want to search for a regular expression pattern. It should be a valid text or cell reference.
* `start_num`. Optional If specified, this argument allows you to specify the starting position of the text.

## Example

Copy and paste the text below into cell A1 in a new worksheet.

{% code overflow="wrap" %}

```
Hello, my name is John Doe. My email is john.doe@example.com. I live in New York, and I work as a software engineer. My hobbies include reading, hiking, and photography. Contact me at +1234567890.
```

{% endcode %}

Copy and paste the regular expression below to the cell A2.

```regex
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
```

| Formula                       | Result |
| ----------------------------- | ------ |
| `=C.SPARK_REGEXSEARCH(A2,A1)` | 41     |


---

# 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:

```
GET https://docs.coherent.global/assistant/custom-functions/regexsearch.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.
