> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# REGEXP_COUNT

> Counts nonoverlapping matches of a regular expression in a string.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns NULL when value or pattern is NULL.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
regexp_count(value, pattern)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING | Yes | The string to search. |
| pattern | STRING | Yes | The regular expression. |

## Returns

* Type: BIGINT
* Possible values: A nonnegative match count, with zero when there is no match.
* NULL behavior: Returns NULL when value or pattern is NULL.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT regexp_count('a1b2c3', '[0-9]') AS matches, regexp_count('abc', '[0-9]') AS no_match;
```

| matches | no\_match |
| - | - |
| 3 | 0 |

### Count groups of digits

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT regexp_count('a12b345', '[0-9]+') AS digit_groups, regexp_count('a12b345', '[0-9]') AS individual_digits;
```

| digit\_groups | individual\_digits |
| - | - |
| 2 | 5 |

## Limitations

* Invalid patterns raise an execution error.
* This form takes two STRING arguments. To set supported regular-expression options, include flags in the pattern. Separate flags and start-position arguments are not available in this form.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.