> For the complete documentation index, see [llms.txt](https://docs.snyk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snyk.io/scan-fix-and-prevent/scan-with-snyk/snyk-secrets/custom-regex-for-secrets.md).

# Custom RegEx for Secrets

How to create custom regex rules that detect secrets specific to your Organization

Snyk Secrets lets you define custom regular expressions (regex) to detect secrets that are specific to your Organization, such as database passwords. You can scope a custom regex rule to a **Group** or one or more **Organizations**.

## Prerequisite

To create a custom regex rule, you need the necessary permissions:

| Permission                   | Name                   | What it allows                                                          |
| ---------------------------- | ---------------------- | ----------------------------------------------------------------------- |
| group.rule\_extension.read   | View Rule Extensions   | See the rule extensions (including Secrets custom regexes) in the group |
| group.rule\_extension.create | Create Rule Extensions | Add new rule extensions in the group                                    |
| group.rule\_extension.edit   | Edit Rule Extensions   | Change existing rule extensions in the group                            |
| group.rule\_extension.delete | Delete Rule Extensions | Permanently remove rule extensions from the group                       |

Refer to [user role management](https://docs.snyk.io/platform-administration/user-management/user-role-management) for further information on configuring custom roles.

## Create a custom regex rule

1. Navigate to **Group settings** > **Snyk Secrets**. The **Custom RegEx Rules** section appears.
2. Click **+ New Rule**.
3. In the **RegEx pattern** field, enter your regex pattern.
4. Optionally, add sample strings to the **Test strings** box to validate the pattern.
5. Optionally, add a description in the **Description** box.
6. Click **Save Draft**.
7. Select the Group or one or more Organizations for the rule scope.
8. Click **Save and activate**.

{% hint style="warning" %}
You cannot edit a custom regex rule after you publish it. You must delete and recreate the rule.
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snyk.io/scan-fix-and-prevent/scan-with-snyk/snyk-secrets/custom-regex-for-secrets.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
