Cookie Consent
Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent.
Read our Privacy Policy
VOCABULARY

Regular expression (regex)

A regular expression (regex) is a sequence of characters that defines a search pattern, often used for pattern matching within strings. It’s commonly used in text processing to find, replace, or validate strings based on certain patterns.

Examples:

  • Basic Pattern Matching:some text
    • Regex: cat
    • Matches: “The cat is on the mat.” (finds the word “cat” in the text)
  • Wildcard Character (.):some text
    • Regex: c.t
    • Matches: “The cat”, “cut”, or “cot” (any character between ‘c’ and ‘t’).
  • Digit Matching (\d):some text
    • Regex: \d{3}
    • Matches: “There are 123 apples.” (matches any sequence of three digits)

Regular expressions allow you to create flexible patterns to handle diverse text search and validation needs. Learn more.

Lakera LLM Security Playbook
Learn how to protect against the most common LLM vulnerabilities

Download this guide to delve into the most common LLM security risks and ways to mitigate them.

Related terms
Activate
untouchable mode.
Get started for free.

Lakera Guard protects your LLM applications from cybersecurity risks with a single line of code. Get started in minutes. Become stronger every day.

Join our Slack Community.

Several people are typing about AI/ML security. 
Come join us and 1000+ others in a chat that’s thoroughly SFW.