> 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

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 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://docs.snyk.io/scan-fix-and-prevent/scan-with-snyk/snyk-secrets/custom-regex-for-secrets.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.
