Back to List

Custom Regular Expression Detector

regex

Detects patterns matching specified regular expressions.

Type

Detector

Model

regex

Latency

5ms

Technical Details

Input Format

Text

Output Format

JSON with match details

Model Architecture

Regular Expression based

Creating a policy example

By defining a policy, you can set a target, combine multiple detectors, and fine-tune.

policy = {
  "id": "regex",
  "definition": "regex policy example",
  "target": "user",
  "override_response": "Ops, sorry!",
  "detectors": [
    {
      "expected": "blocked",
      "model": "regex",
      "threshold": 0.5
    }
  ]
};

payload = {
  "message": messages,
  "policies": [policy],
  "enabled_policies": ["regex"]
};

Tags

Pattern Matching
Regex
Message 1

Enabled Policies

Results

No Threat

Low Risk
Threat Type: prompt-attack
Threat Confidence: 0.001%

Policy Results:

  • prompt-defense: No threat detected (Threat Confidence: 0.001%)