Skip to content
SIEMBench
100% Client-Side Tool • Inputs Never Sent to Our Servers

SIEM Regex Tester & Pattern Library

Write or load a pattern, see every match and capture group in your log, and copy a query for your SIEM. Runaway patterns are stopped automatically.

Pattern library

Enter a pattern.

Matches

Matches and capture groups

#LineMatch

Catastrophic backtracking (ReDoS)

No risky structure found. Matching also runs in a worker that is stopped after 1.5 seconds.

    Engine compatibility

    • MediumAnchors ^ and $ (Elastic EQL)

      Lucene has no anchors, and a pattern must match the whole field. The snippet adds .* where it is needed.

    • InfoShorthand classes \d, \w and \s (Sentinel KQL)

      KQL matches Unicode digits and letters with these. JavaScript and RE2 match ASCII only. Use [0-9] to be exact.

    • Infom flag (Splunk SPL, Sentinel KQL, Google SecOps, Elastic EQL)

      A SIEM usually evaluates one event at a time, so ^ and $ per line matter only for multi-line events.

    SIEM query snippet

    How to use this tool in a SOC investigation

    1. Paste real log lines and load the closest pattern from the library.
    2. Adjust the named groups until every match is right, including lines that should not match.
    3. Read the risk and RE2 notes, then copy the snippet for your SIEM.

    Example: To list accounts behind failed logons in raw text, load the Windows Event ID & Account Name pattern. On its sample it captures event_id 4625 with account j.doe, and event_id 4720 with account svc_backup2.

    Frequently asked questions

    Are my logs or patterns uploaded?

    No. Matching runs in a worker inside the page, and there are no network requests. You can load the page, disconnect and keep testing. Exports are created in browser memory and saved directly to your device.

    Why does a pattern that works here fail in KQL or Google SecOps?

    This page uses the JavaScript engine, which supports lookahead, lookbehind and backreferences. KQL and Google SecOps use RE2-style engines that leave those features out so that matching time stays predictable. The compatibility panel flags them, along with smaller differences such as Unicode digits and repeat limits.

    What is catastrophic backtracking?

    It is what happens when a pattern can split the same text in a huge number of ways and the engine tries them all before giving up. The pattern ^(a+)+$ against thirty letters and one wrong character can take minutes. The tool warns about structures that cause it and stops any run after 1.5 seconds.

    How do I escape quotes and backslashes in Splunk rex?

    Inside the double-quoted string, write a quote as \" and a literal backslash as four backslashes, because SPL removes one level and the regex engine another. Shorthand such as \d needs no change. The Splunk snippet applies these rules for you.

    Regex engines across SIEM platforms

    A regular expression is not portable by default. Each product embeds a particular engine, and engines differ in features, speed and small details of meaning. A pattern that works in a tester can fail to compile in production or, worse, compile and match something else.

    PlatformEngine familyLookaround and backreferencesNotes
    Splunk (rex, regex)PCREYesBacktracking. rex extracts named groups.
    Microsoft Sentinel (KQL)RE2-styleNo\d and \w match Unicode.
    Google SecOps (YARA-L)RE2-styleNoUse back-quoted strings.
    Elastic (regexp, EQL)LuceneNoNo anchors. Matches the whole field.
    This pageJavaScriptYesRuns in a worker with a time limit.

    Why RE2 leaves out lookarounds and backreferences

    PCRE and JavaScript engines backtrack. At each choice they try one option and return to try another if the rest fails. This supports powerful features, but the number of paths can grow exponentially with the length of the text.

    RE2 takes a different approach. It simulates every possibility at once, in the manner of a finite automaton, and reads each character a bounded number of times. Matching time is proportional to the length of the input, whatever the pattern. A cloud service that runs untrusted queries from many customers needs exactly that promise, because one bad pattern could otherwise consume a whole node.

    The price is features. A backreference such as (\w+) \1 requires remembering arbitrary text, which a finite automaton cannot do, and no efficient general algorithm is known. Lookaround does not fit the single-pass design. RE2 also rejects repeat counts above 1,000.

    Rewriting for RE2

    Catastrophic backtracking in practice

    Three structures cause most incidents, and the checker looks for each of them:

    StructureRiskySafer
    Repeat inside a repeat(\w+\s?)+\w+(?:\s\w+)*
    Overlapping alternatives(\d|\w)+\w+
    Neighboring repeats\s*.*.*

    A required separator makes nesting safe. In (?:\d+\.)+ the dot cannot be matched by \d, so there is only one way to divide the text. Attackers control much of what appears in logs, such as user agents and URLs, so a vulnerable pattern in a detection pipeline is a denial-of-service target.

    Named capture groups for log parsing

    Numbered groups shift when someone adds a parenthesis. A named group documents itself and keeps its meaning:

    ^(?<ip>\S+) \S+ (?<user>\S+) \[(?<time>[^\]]+)\] "(?<method>[A-Z]+) (?<path>\S+)

    Performance in high-volume SIEM queries

    1. Filter before you match. Limit the index, source type and time range first. A regex cannot use an index.
    2. Use plain terms when you can. In KQL, has uses the term index, while matches regex scans. In Splunk, put literal words before the first pipe.
    3. Anchor the pattern. ^ lets the engine give up quickly on lines that cannot match.
    4. Be specific. Replace .* with the characters you expect, and put an upper limit on repeats.
    5. Extract once. If several searches need a field, parse it at ingest instead of in each query.
    6. Test near misses. Slow behavior appears on long lines that almost match, and not on lines that match.

    About the library and snippets

    The ten library patterns avoid lookaround and backreferences, so they compile in RE2-style engines. They are starting points and not complete detections. The IPv4 pattern also matches version numbers, a 32-character hex string may be NTLM instead of MD5, and encoded PowerShell has legitimate uses in management software. Samples use documentation addresses, and the AWS key is the example that Amazon publishes.

    Snippets escape the pattern for each language. Splunk strings treat \" and \\ specially. KQL verbatim strings double the quote. YARA-L back-quoted strings have no escapes. The Elastic snippet rewrites the pattern for Lucene by expanding shorthand classes, removing anchors and adding .*, and the panel lists anything lost on the way. Replace field names such as RawData and message with your own, and run the query on a small time range before you rely on it.

    Does the risk check guarantee that a pattern is safe?

    No. It is a static heuristic that looks for nested repeats, overlapping alternatives and neighboring repeats that match the same characters. It can miss unusual cases and can flag patterns that are harmless on your data. The timeout is the real protection on this page. In production, test against long lines that almost match.