---
title: Count occurrences
description: Count how many times a pattern appears across column values using string or regex matching.
category: Data Transformation
tags: [count, string, pattern, match, regex]
---

# Count occurrences

## Description

The **Count Occurrences** activity tallies how often a specific pattern appears in selected column(s) of a dataset. You can match based on:

- **Substring**: Partial match within the cell.
- **Complete value**: Full-cell match only.
- **Regular expression**: Advanced pattern matching using regex.

You can also choose whether the pattern match should be **case-sensitive** or **case-insensitive**.

Use this activity to:

- Track brand or keyword presence in product names or descriptions.
- Identify how often a specific value or format appears.
- Apply text analysis or cleaning logic.

> **Use case**: Count how many times the word `Boat` appears in a product list using substring matching (case-insensitive).

## Input

- **Data** – Required. Tabular data with at least one text column.

## Output

| Output Type | Format | Description                                            |
| ----------- | ------ | ------------------------------------------------------ |
| **Data**    | JSON   | Dataset with a new column showing the count of matches |

## Configuration Fields

| Field Name        | Description                                                                                    |
| ----------------- | ---------------------------------------------------------------------------------------------- |
| **Column Names**  | One or more columns to search within.                                                          |
| **Pattern**       | The string or regular expression to search for.                                                |
| **Matching Mode** | Determines how the pattern is matched: `Substring`, `Complete Value`, or `Regular Expression`. |
| **Match Case**    | Choose between case-sensitive and case-insensitive matching .                                  |

## Sample Input

| product_id | product_name                     |
| ---------- | -------------------------------- |
| B07JW9H4J1 | Boat Bluetooth Speaker           |
| B07AB2CD34 | Boat Wired Headphones            |
| B07XY1MN67 | Sony Wireless Headphones         |
| B07EF3PL88 | Boat Rockerz Bluetooth Earphones |
| B08GZZ8FQT | Boat Audio System                |

## Sample Configuration

| Field           | Value              |
| --------------- | ------------------ |
| `Column Names`  | `["product_name"]` |
| `Pattern`       | `Boat`             |
| `Matching Mode` | `Substring`        |
| `Match Case`    | `false`            |

<!-- ![Count Occurrences](count-occurrences-img.png) -->

## Sample Output

| Pattern_Count |
| ------------- |
| 4             |
