Pattern Name
Regex Prompt Guard Policy
Policy Name |
Regex Prompt Guard |
Summary |
Blocks LLM requests that match deny-list regex patterns |
Category |
LLM |
First Flex Gateway version available |
v1.11.4 |
Returned Status Codes |
403 - Forbidden: Request blocked because prompt content matched one or more denied patterns |
Summary
| This policy only supports OpenAI format LLM endpoints. |
The Regex Prompt Guard policy scans LLM prompts and blocks requests when prompt content matches Perl Compatible Regular Expressions (PCRE) deny-list patterns.
To learn more about PCRE, see PCRE - Perl Compatible Regular Expressions.
For example, you can use the policy to block attacks such as:
-
Prompt injection
-
Jailbreak attempts
-
SQL injection patterns
-
HTML script injection
Configuring Policy Parameters
Managed Flex Gateway and Flex Gateway Connected Mode
When you apply the policy from the UI, the following parameters are displayed:
| Element | Required | Description |
|---|---|---|
Yes |
Human-readable pattern name. The policy includes this value in the blocked-response details. |
|
Regex Pattern |
Yes |
PCRE-compatible regex expression used to match prompt content. Use |
Response on Block
When a request is blocked, the policy returns a response body containing the matched deny patterns:
{
"error": "Request blocked - content matches denied pattern",
"matched_patterns": [
"prompt-injection"
]
}
See Also
-
LLM Proxy - Overview of LLM Proxy and routing
-
LLM Token Based Rate Limit - Token-based rate limiting for LLM Proxy



