Dataset Viewer
Auto-converted to Parquet Duplicate
problem_id
stringlengths
28
42
title
stringlengths
23
49
category
stringclasses
5 values
effort
stringclasses
2 values
prompt
stringlengths
266
448
positive_tests
stringlengths
45
142
negative_tests
stringlengths
46
167
canonical_ref
stringlengths
17
339
extracted_regex
stringlengths
14
220
reasoning_content
stringlengths
1.78k
10.1k
response_content
stringlengths
0
222
status
stringclasses
2 values
reward
float64
0
1
positive_passed
int64
0
8
positive_total
int64
3
8
negative_passed
int64
0
9
negative_total
int64
5
9
redos_safe
bool
2 classes
redos_latency_ms
float64
0
80
diagnosis
stringclasses
10 values
latency_sec
float64
1.13
6.68
model
stringclasses
1 value
redos_01_nested_word_repeats
Nested Word Repetition Refactor
redos_defense
low
Write a Python regular expression that matches a sequence of words separated by spaces ending with an exclamation mark, like 'hello world!'. CRITICAL: Avoid catastrophic backtracking (ReDoS). A naive pattern like r'^((\w+)\s*)+!$' hangs on strings like 'a a a a a ... a'. Your regex must process pathological input in li...
["hello!", "hello world!", "the quick brown fox jumps over the lazy dog!", "word1 word2 word3!"]
["hello", "hello world", "hello world? ", "!hello", "hello ! world"]
^\w+(?:\s+\w+)*!$
^\w+(?:\s+\w+)*!$
We need answer regex pattern. Need reason. Need match sequence of words separated by spaces ending with !. Like 'hello world!'. Need avoid catastrophic backtracking. Need Python regex. Need output only final regex pattern in backticks. Need likely pattern: r'^\w+(?:\s+\w+)*!$' or r'^\w+(?: +\w+)*!$'? Let's parse requir...
`r'^\w+(?:\s+\w+)*!$'`
PASS
1
4
4
5
5
true
0.02
Fully verified: 100% test pass and ReDoS-immune.
3.48
reflection/Beam-1.0-501B-A23B
redos_02_safe_email_localpart
ReDoS-Safe Email Local-Part Parser
redos_defense
low
Write a regular expression that validates an email local-part (before the '@'). It must consist of alphanumeric characters and dots, but CANNOT start or end with a dot, and CANNOT have two consecutive dots (e.g. 'john.doe' is valid, 'john..doe' is invalid). Ensure the pattern is completely immune to catastrophic backtr...
["john", "john.doe", "alice.smith.dev", "user123.test456"]
[".john", "john.", "john..doe", "john@doe", "john.doe..test"]
^[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*$
^[A-Za-z0-9]+(?:\.[A-Za-z0-9]+)*$
We need answer regex pattern. Need reason. Need validate email local-part before @. Alphanumeric and dots. Cannot start/end dot, no consecutive dots. Immune catastrophic backtracking long strings followed invalid char. Need output only final regex in backticks. We need craft regex. Likely anchored? "validates" maybe f...
`^[A-Za-z0-9]+(?:\.[A-Za-z0-9]+)*$`
PASS
1
4
4
5
5
true
0.01
Fully verified: 100% test pass and ReDoS-immune.
5.07
reflection/Beam-1.0-501B-A23B
redos_03_safe_comma_separated_quoted
Safe Comma-Separated Values with Optional Quotes
redos_defense
low
Write a regex matching comma-separated list of items where each item is either plain alphanumeric OR enclosed in double quotes (e.g. 'apple,"banana",cherry'). Items cannot be empty. Must be strictly linear time and resist ReDoS when matching long lists. Output only the final regex pattern in backticks.
["apple", "\"banana\"", "apple,\"banana\",cherry", "\"alpha\",\"beta\",\"gamma\"", "1,2,\"3\",4"]
["", ",", "apple,", ",apple", "apple,\"unclosed", "apple,\"banana\"orange"]
^(?:[a-zA-Z0-9]+|"[^"\n]*")(?:,(?:[a-zA-Z0-9]+|"[^"\n]*"))*$
^(?:[A-Za-z0-9]+|"[^"]+")(?:,(?:[A-Za-z0-9]+|"[^"]+"))*$
We need answer regex pattern. Need parse requirements carefully. Need output only final regex pattern in backticks. Need ensure linear time, no ReDoS. Need match comma-separated list of items where each item either plain alphanumeric OR enclosed in double quotes. Items cannot be empty. Example 'apple,"banana",cherry'. ...
`^(?:[A-Za-z0-9]+|"[^"]+")(?:,(?:[A-Za-z0-9]+|"[^"]+"))*$`
PASS
1
5
5
6
6
true
0.02
Fully verified: 100% test pass and ReDoS-immune.
6.08
reflection/Beam-1.0-501B-A23B
redos_04_safe_url_slug_hierarchy
Safe URL Path Hierarchy
redos_defense
low
Write a regex matching valid URL slugs separated by slashes without trailing slash, such as '/blog/2026/my-post'. Each segment must start with a slash and contain lowercase letters, numbers, or hyphens (cannot start or end with a hyphen). Must not catastrophically backtrack. Output only the final regex pattern in backt...
["/home", "/blog/my-post", "/docs/v2/api-reference-123", "/a/b/c"]
["home", "/", "/blog/", "/blog/-invalid", "/blog/invalid-", "/blog//double"]
^(?:/[a-z0-9]+(?:-[a-z0-9]+)*)+$
^(?:/[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$
We need answer regex. Need parse requirements carefully. "Write a regex matching valid URL slugs separated by slashes without trailing slash, such as '/blog/2026/my-post'. Each segment must start with a slash and contain lowercase letters, numbers, or hyphens (cannot start or end with a hyphen). Must not catastrophica...
`^(?:/[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$`
PASS
1
4
4
6
6
true
0.01
Fully verified: 100% test pass and ReDoS-immune.
4.77
reflection/Beam-1.0-501B-A23B
automata_01_binary_divisible_by_3
Binary Numbers Divisible by 3 (DFA)
automata_theory
low
Write a regular expression that matches any non-empty binary string (consisting only of '0' and '1') that represents a binary number divisible by 3. Leading zeros are permitted. For example: '0' (0), '11' (3), '110' (6), '1001' (9), '1100' (12) are valid. '1' (1), '10' (2), '100' (4), '101' (5), '111' (7) are invalid. ...
["0", "000", "11", "110", "1001", "1100", "1111", "10010"]
["", "1", "10", "100", "101", "111", "1000", "1010", "1011"]
^(?:0|1(?:01*0)*1)+$
(0|1(01*0)*1)+
We need answer regex. Need solve. Need construct regex from minimal 3-state DFA for binary strings divisible by 3. Need output only final regex pattern in backticks. Need ensure no catastrophic backtracking. Need reason. We need regex matching non-empty binary strings representing number divisible by 3. Leading zeros ...
`(0|1(01*0)*1)+`
PASS
1
8
8
9
9
true
0.04
Fully verified: 100% test pass and ReDoS-immune.
3.83
reflection/Beam-1.0-501B-A23B
automata_02_even_zeros_odd_ones
Even Number of 0s and Odd Number of 1s
automata_theory
low
Write a regular expression matching any non-empty binary string containing an EVEN number of '0's and an ODD number of '1's. For instance: '1' (0 zeros, 1 one -> valid), '001' (2 zeros, 1 one -> valid), '010' (valid), '111' (0 zeros, 3 ones -> valid). '01' (1 zero -> invalid), '0011' (2 ones -> invalid). Output only th...
["1", "001", "010", "100", "111", "01011", "10000"]
["", "0", "01", "10", "11", "00", "0011", "0001"]
^(?:(?:00|11)|(?:01|10)(?:00|11)*(?:01|10))*(?:1|(?:01|10)(?:00|11)*0)$
^(00|11|0101|...)*...
We need answer regex. Need construct regex matching non-empty binary strings with even number of 0s and odd number of 1s. Need output only final regex in backticks. Need ensure no catastrophic backtracking. Need reason. We need regex over {0,1}. Conditions: count0 even, count1 odd. Non-empty automatically if count1 od...
FAIL
0.7429
6
7
8
8
true
0.03
Partial match: 6/7 positive, 8/8 negative passed.
5.5
reflection/Beam-1.0-501B-A23B
automata_03_no_consecutive_identical_chars
Strict Alternating Alphabet String
automata_theory
low
Write a regex over the alphabet {a, b, c} of length at least 1 such that no two adjacent characters are identical (e.g. 'abacb' is valid, 'abbc' is invalid). Use negative lookahead to strictly forbid identical adjacent characters. Output only the final regex pattern in backticks.
["a", "ab", "aba", "abc", "abacbca", "cbabc"]
["", "aa", "abb", "aab", "abacc", "d", "ab d"]
^(?:([abc])(?!\1))+$
^(?!.*([abc])\1)[abc]+$
We need answer regex over alphabet {a,b,c} length at least 1 such that no two adjacent chars identical. Use negative lookahead to strictly forbid identical adjacent characters. Output only final regex pattern in backticks. Need craft regex. Need likely anchored? "over alphabet" maybe pattern matches strings. Need leng...
`^(?!.*([abc])\1)[abc]+$`
PASS
1
6
6
7
7
true
0.01
Fully verified: 100% test pass and ReDoS-immune.
1.94
reflection/Beam-1.0-501B-A23B
lookaround_01_strong_password_rules
Multi-Constraint Password Validation
lookaround_logic
low
Write a regular expression that validates a strong password with all the following criteria: 1. Length between 10 and 32 characters. 2. At least one uppercase letter [A-Z]. 3. At least one lowercase letter [a-z]. 4. At least one digit [0-9]. 5. At least one special character from [!@#$%^&*]. 6. Must NOT contain the sub...
["CorrectHorse#1", "P@ssw0rdValid!", "SuperSecret99$", "V3ryStr0ng!Key"]
["Short1!", "nouppercase123!", "NOLOWERCASE123!", "NoDigitsHere!", "NoSpecialChar123", "myPassword!123", "adminAccess#2026"]
^(?!.*(?i:password|admin))(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z0-9!@#$%^&*]{10,32}$
^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*])(?!.*(?:[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]|[Aa][Dd][Mm][Ii][Nn])).{10,32}$
We need answer regex only final in backticks. Need craft robust regex no ReDoS. Need validate strong password criteria length 10-32, char classes? Special from set. Must not contain substring password/admin case-insensitive. Need decide allowed characters? Criteria says at least special from set, but doesn't explicitly...
`^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*])(?!.*(?:[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]|[Aa][Dd][Mm][Ii][Nn])).{10,32}$`
PASS
1
4
4
7
7
true
0.01
Fully verified: 100% test pass and ReDoS-immune.
4.26
reflection/Beam-1.0-501B-A23B
lookaround_02_negative_extension_filter
Filename Filter with Forbidden Extensions
lookaround_logic
low
Write a regex matching filenames with an alphanumeric name, a dot, and an extension, EXCEPT files with extensions .exe, .bat, or .sh (case-insensitive). Valid examples: 'photo.jpg', 'data.csv', 'archive.tar.gz'. Invalid: 'run.exe', 'script.SH', 'bad.bat'. Output only the final regex pattern in backticks.
["document.pdf", "image.png", "backup.tar.gz", "source.py", "notes.txt"]
["installer.exe", "INSTALLER.EXE", "setup.bat", "deploy.sh", "test.Sh", "noextension"]
^(?!.*(?i:\.(?:exe|bat|sh))$)[a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+)+$
^(?i)[a-z0-9]+(?:\.[a-z0-9]+)*\.(?!exe|bat|sh$)[a-z0-9]+$
We need answer regex. Need parse requirements. Filenames with alphanumeric name, a dot, and extension. Except extensions .exe .bat .sh case-insensitive. Valid examples include 'archive.tar.gz' (multiple dots? name alphanumeric? extension? Need interpret). Need produce regex. Need output only final regex pattern in back...
`^(?i)[a-z0-9]+(?:\.[a-z0-9]+)*\.(?!exe|bat|sh$)[a-z0-9]+$`
FAIL
0
0
5
0
6
true
0
Syntax error: global flags not at the start of the expression at position 1
3.46
reflection/Beam-1.0-501B-A23B
lookaround_03_surrounded_tag_content
Balanced Tag Content Extractor
lookaround_logic
low
Write a regular expression that matches the content between matching brackets [bracket] or (paren) or {brace}, asserting that opening and closing delimiters match symmetrically. For example '[test]' or '(sample)' or '{code}'. Mismatched pairs like '[sample)' or '(code}' must fail. Output only the final regex pattern in...
["[test]", "(sample)", "{code}", "[12345]", "(hello world)"]
["[sample)", "(test]", "{mismatch]", "[unclosed", "unopened]", "[]"]
^(?:\[(?=[^\]]+\])([^\]]+)\]|\((?=[^\)]+\))([^\)]+)\)|\{(?=[^\}]+\})([^\}]+)\})$
(?<=\[)[^\]]*(?=\])|(?<=\()[^)]*(?=\))|(?<=\{)[^}]*(?=\})
We need answer regex pattern. Need parse problem carefully. "matches the content between matching brackets [bracket] or (paren) or {brace}, asserting that opening and closing delimiters match symmetrically. For example '[test]' or '(sample)' or '{code}'. Mismatched pairs like '[sample)' or '(code}' must fail. Output on...
`(?<=\[)[^\]]*(?=\])|(?<=\()[^)]*(?=\))|(?<=\{)[^}]*(?=\})`
PASS
1
5
5
6
6
true
0
Fully verified: 100% test pass and ReDoS-immune.
4.68
reflection/Beam-1.0-501B-A23B
struct_01_strict_ipv4_octet_range
Strict IPv4 Address with 0-255 Octet Verification
structured_data
low
Write a regular expression that matches a valid IPv4 address in dot-decimal notation. Each of the 4 octets must be strictly between 0 and 255. Leading zeros in multi-digit numbers are FORBIDDEN (e.g. '192.168.01.1' is invalid, '0.0.0.0' is valid). Numbers > 255 (like 256 or 300) must be rejected. Output only the final ...
["0.0.0.0", "127.0.0.1", "192.168.1.1", "255.255.255.255", "10.0.254.99"]
["256.1.1.1", "192.168.01.1", "192.168.1.00", "1.2.3.4.5", "1.2.3", "1.2.3.999", "300.0.0.0"]
^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)$
^(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}$
We need answer regex. Need final only pattern in backticks. Need reason. Need match valid IPv4 dot-decimal, octets 0-255, no leading zeros in multi-digit. Need avoid ReDoS. Need output only final regex pattern in backticks. We can provide concise. Need construct robust regex. Common: ^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][...
`^(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}$`
PASS
1
5
5
7
7
true
0
Fully verified: 100% test pass and ReDoS-immune.
2.6
reflection/Beam-1.0-501B-A23B
struct_02_semantic_versioning_2_0
Strict SemVer 2.0.0 Specification
structured_data
low
Write a regex matching full Semantic Versioning 2.0.0 format. MAJOR.MINOR.PATCH with optional pre-release (-alpha.1) and optional build metadata (+20260101). Leading zeros in numeric identifiers are forbidden (e.g. '01.0.0' is invalid, '0.1.0' is valid). Output only the final regex pattern in backticks.
["0.0.4", "1.2.3", "10.20.30", "1.1.2-prerelease+meta", "1.0.0-alpha.1", "1.0.0-0.3.7", "1.0.0+20130313144700"]
["1", "1.2", "01.1.1", "1.02.1", "1.1.03", "1.2.3-", "1.2.3+", "v1.2.3"]
^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-((?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][A-Za-z0-9-]*)(?:\.(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][A-Za-z0-9-]*))*))?(?:\+([A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*))?$
We need answer regex matching full SemVer 2.0.0. Need output only final regex pattern in backticks. Need reason carefully. Need produce regex. Let's recall SemVer 2.0.0 grammar: <valid semver> ::= <version core> | <version core> "-" <pre-release> | <version core> "+" <build> ...
`^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-((?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][A-Za-z0-9-]*)(?:\.(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][A-Za-z0-9-]*))*))?(?:\+([A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*))?$`
PASS
1
7
7
8
8
true
0.02
Fully verified: 100% test pass and ReDoS-immune.
5.4
reflection/Beam-1.0-501B-A23B
struct_03_iso_8601_strict_timestamp
ISO-8601 UTC / Offset Timestamp
structured_data
low
Write a regular expression matching an ISO-8601 date-time string in format YYYY-MM-DDTHH:MM:SS with optional fraction of a second (.sss) and either 'Z' or a valid timezone offset [+-]HH:MM. Hours must be 00-23, minutes and seconds 00-59. Output only the final regex pattern in backticks.
["2026-10-23T12:00:00Z", "2026-01-01T00:00:00.123Z", "2026-07-15T23:59:59+01:00", "2026-12-31T18:30:00.999-05:00"]
["2026-10-23", "2026-10-23 12:00:00", "2026-10-23T24:00:00Z", "2026-10-23T12:60:00Z", "2026-10-23T12:00:60Z", "2026-10-23T12:00:00+25:00"]
^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$
^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d{3})?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$
We need answer regex. Need craft ISO-8601 date-time YYYY-MM-DDTHH:MM:SS optional fraction .sss and either Z or offset [+-]HH:MM. Hours 00-23, minutes seconds 00-59. Need likely date validation? "ISO-8601 date-time string in format YYYY-MM-DDTHH:MM:SS" maybe date components? They specify hours/min/sec ranges. Need regex...
`^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d{3})?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$`
PASS
1
4
4
6
6
true
0
Fully verified: 100% test pass and ReDoS-immune.
3.24
reflection/Beam-1.0-501B-A23B
struct_04_standard_cron_expression
Standard 5-Field Cron Expression
structured_data
low
Write a regex matching a standard 5-field cron expression (minute hour dom month dow). Fields are separated by single spaces. Allow single numbers, asterisks '*', step values '*/5', and comma-separated lists '1,2,3'. Output only the final regex pattern in backticks.
["* * * * *", "*/5 * * * *", "0 12 * * 1-5", "30 4 1,15 * 5", "0 0 1 1 *"]
["* * * *", "* * * * * *", "*/ * * * *", "60 * * * *", "empty"]
^(?:(?:\*|(?:[0-5]?\d)(?:-[0-5]?\d)?)(?:/[0-5]?\d)?(?:,(?:(?:\*|(?:[0-5]?\d)(?:-[0-5]?\d)?)(?:/[0-5]?\d)?))*)\s+(?:(?:\*|(?:1\d|2[0-3]|\d)(?:-(?:1\d|2[0-3]|\d))?)(?:/(?:1\d|2[0-3]|\d))?)\s+(?:(?:\*|(?:[12]\d|3[01]|[1-9])(?:-(?:[12]\d|3[01]|[1-9]))?)(?:,(?:[12]\d|3[01]|[1-9]))*)\s+(?:(?:\*|(?:1[0-2]|[1-9])))\s+(?:(?:\*|...
^(?:\*(?:/\d+)?|\d+(?:,\d+)*)(?: (?:\*(?:/\d+)?|\d+(?:,\d+)*)){4}$
We need answer regex pattern. Need parse request: "Write a regex matching a standard 5-field cron expression (minute hour dom month dow). Fields are separated by single spaces. Allow single numbers, asterisks '*', step values '*/5', and comma-separated lists '1,2,3'. Output only the final regex pattern in backticks." ...
`^(?:\*(?:/\d+)?|\d+(?:,\d+)*)(?: (?:\*(?:/\d+)?|\d+(?:,\d+)*)){4}$`
FAIL
0.64
4
5
4
5
true
0.01
Partial match: 4/5 positive, 4/5 negative passed.
4.25
reflection/Beam-1.0-501B-A23B
delim_01_json_escaped_string
JSON-Compliant String with Escape Sequences
syntax_parsing
low
Write a regex that matches a valid JSON double-quoted string literal. It must start and end with double quotes. Inside, it can contain any character except unescaped quotes or control characters. Allowed escape sequences are \", \\, \/, \b, \f, \n, \r, \t, or unicode escapes \uXXXX where X is a hex digit. Output only t...
["\"\"", "\"hello world\"", "\"line 1\\nline 2\"", "\"escaped \\\"quote\\\" inside\"", "\"unicode \\u0041\\u0042\"", "\"path\\\\to\\\\file\""]
["", "\"unclosed string", "unescaped \" quote\"", "\"invalid \\escape\"", "\"bad unicode \\u12G4\""]
^"(?:[^"\\\x00-\x1f]|\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4}))*"$
^"(?:[^"\\\x00-\x1f]|\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4}))*"$
We need answer regex. Need craft valid JSON double-quoted string literal. Need only final regex in backticks. Need ensure no catastrophic backtracking. Need reason. JSON string grammar: " (char)* " where char is any Unicode except quote/control, or escape. Escape: \" \\ \/ \b \f \n \r \t \uXXXX. Control chars excluded...
`^"(?:[^"\\\x00-\x1f]|\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4}))*"$`
PASS
1
6
6
5
5
true
0.02
Fully verified: 100% test pass and ReDoS-immune.
2.06
reflection/Beam-1.0-501B-A23B
delim_02_markdown_inline_links
Markdown Inline Link [text](url) Parser
syntax_parsing
low
Write a regex matching a complete markdown inline link [anchor text](https://url). The anchor text inside brackets cannot be empty and cannot contain square brackets. The URL inside parentheses must start with http:// or https:// and cannot contain spaces or parens. Output only the final regex pattern in backticks.
["[Google](https://google.com)", "[Hugging Face](https://huggingface.co/models)", "[Docs](http://localhost:8000/api)"]
["[](https://google.com)", "[[nested]](https://google.com)", "[Google](ftp://google.com)", "[Google](https://google.com with spaces)", "[Google] (https://google.com)"]
^\[([^\[\]\n]+)\]\((https?://[^\s\(\)]+)\)$
^\[[^\[\]]+\]\(https?://[^()\s]+\)$
We need answer regex pattern. Need parse requirements. Markdown inline link [anchor text](https://url). Anchor text inside brackets cannot be empty and cannot contain square brackets. URL inside parentheses must start with http:// or https:// and cannot contain spaces or parens. Need complete match likely entire string...
`^\[[^\[\]]+\]\(https?://[^()\s]+\)$`
PASS
1
3
3
5
5
true
0
Fully verified: 100% test pass and ReDoS-immune.
3.3
reflection/Beam-1.0-501B-A23B
redos_01_nested_word_repeats
Nested Word Repetition Refactor
redos_defense
medium
Write a Python regular expression that matches a sequence of words separated by spaces ending with an exclamation mark, like 'hello world!'. CRITICAL: Avoid catastrophic backtracking (ReDoS). A naive pattern like r'^((\w+)\s*)+!$' hangs on strings like 'a a a a a ... a'. Your regex must process pathological input in li...
["hello!", "hello world!", "the quick brown fox jumps over the lazy dog!", "word1 word2 word3!"]
["hello", "hello world", "hello world? ", "!hello", "hello ! world"]
^\w+(?:\s+\w+)*!$
^\w+(?:\s+\w+)*!$
We need answer regex pattern only final in backticks. Need solve. Need think carefully. Need match sequence of words separated by spaces ending with !. Like 'hello world!'. Need avoid ReDoS. Naive r'^((\w+)\s*)+!$' hangs on 'a a a ... a' (no !). Need linear time. We need produce Python regex. Need define words separat...
`r'^\w+(?:\s+\w+)*!$'`
PASS
1
4
4
5
5
true
0.02
Fully verified: 100% test pass and ReDoS-immune.
3.89
reflection/Beam-1.0-501B-A23B
redos_02_safe_email_localpart
ReDoS-Safe Email Local-Part Parser
redos_defense
medium
Write a regular expression that validates an email local-part (before the '@'). It must consist of alphanumeric characters and dots, but CANNOT start or end with a dot, and CANNOT have two consecutive dots (e.g. 'john.doe' is valid, 'john..doe' is invalid). Ensure the pattern is completely immune to catastrophic backtr...
["john", "john.doe", "alice.smith.dev", "user123.test456"]
[".john", "john.", "john..doe", "john@doe", "john.doe..test"]
^[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*$
^[A-Za-z0-9]+(?:\.[A-Za-z0-9]+)*$
We need answer regex pattern only in backticks. Need solve. Need think carefully about ReDoS immunity. Validate email local-part: alphanumeric chars and dots, cannot start/end dot, no consecutive dots. Need pattern completely immune to catastrophic backtracking when given long strings of chars followed by invalid char....
`^[A-Za-z0-9]+(?:\.[A-Za-z0-9]+)*$`
PASS
1
4
4
5
5
true
0.02
Fully verified: 100% test pass and ReDoS-immune.
5.92
reflection/Beam-1.0-501B-A23B
redos_03_safe_comma_separated_quoted
Safe Comma-Separated Values with Optional Quotes
redos_defense
medium
Write a regex matching comma-separated list of items where each item is either plain alphanumeric OR enclosed in double quotes (e.g. 'apple,"banana",cherry'). Items cannot be empty. Must be strictly linear time and resist ReDoS when matching long lists. Output only the final regex pattern in backticks.
["apple", "\"banana\"", "apple,\"banana\",cherry", "\"alpha\",\"beta\",\"gamma\"", "1,2,\"3\",4"]
["", ",", "apple,", ",apple", "apple,\"unclosed", "apple,\"banana\"orange"]
^(?:[a-zA-Z0-9]+|"[^"\n]*")(?:,(?:[a-zA-Z0-9]+|"[^"\n]*"))*$
^(?:[A-Za-z0-9]+|"[^"]+") (?:,(?:[A-Za-z0-9]+|"[^"]+"))*$
We need answer regex pattern. Need parse requirements. Need produce final regex in backticks only? User says Output only final regex pattern in backticks. We need reason. We need regex matching comma-separated list of items where each item either plain alphanumeric OR enclosed in double quotes. Items cannot be empty. ...
FAIL
0.4
0
5
6
6
true
0.01
Partial match: 0/5 positive, 6/6 negative passed.
6.35
reflection/Beam-1.0-501B-A23B
redos_04_safe_url_slug_hierarchy
Safe URL Path Hierarchy
redos_defense
medium
Write a regex matching valid URL slugs separated by slashes without trailing slash, such as '/blog/2026/my-post'. Each segment must start with a slash and contain lowercase letters, numbers, or hyphens (cannot start or end with a hyphen). Must not catastrophically backtrack. Output only the final regex pattern in backt...
["/home", "/blog/my-post", "/docs/v2/api-reference-123", "/a/b/c"]
["home", "/", "/blog/", "/blog/-invalid", "/blog/invalid-", "/blog//double"]
^(?:/[a-z0-9]+(?:-[a-z0-9]+)*)+$
^(?:/[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$
We need answer regex. Need parse requirements carefully. "Write a regex matching valid URL slugs separated by slashes without trailing slash, such as '/blog/2026/my-post'. Each segment must start with a slash and contain lowercase letters, numbers, or hyphens (cannot start or end with a hyphen). Must not catastrophica...
`^(?:/[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$`
PASS
1
4
4
6
6
true
0.02
Fully verified: 100% test pass and ReDoS-immune.
5.31
reflection/Beam-1.0-501B-A23B
automata_01_binary_divisible_by_3
Binary Numbers Divisible by 3 (DFA)
automata_theory
medium
Write a regular expression that matches any non-empty binary string (consisting only of '0' and '1') that represents a binary number divisible by 3. Leading zeros are permitted. For example: '0' (0), '11' (3), '110' (6), '1001' (9), '1100' (12) are valid. '1' (1), '10' (2), '100' (4), '101' (5), '111' (7) are invalid. ...
["0", "000", "11", "110", "1001", "1100", "1111", "10010"]
["", "1", "10", "100", "101", "111", "1000", "1010", "1011"]
^(?:0|1(?:01*0)*1)+$
We need answer regex. Need solve. Need output only final regex pattern in backticks. Need reason.
We need answer regex. Need solve. Need output only final regex pattern in backticks. Need reason. We need regex matching non-empty binary strings representing binary number divisible by 3. Leading zeros permitted. Minimal 3-state DFA. Need construct regex from minimal 3-state DFA. Need avoid catastrophic backtracking....
FAIL
0.4
0
8
9
9
true
0
Partial match: 0/8 positive, 9/9 negative passed.
6.68
reflection/Beam-1.0-501B-A23B
automata_02_even_zeros_odd_ones
Even Number of 0s and Odd Number of 1s
automata_theory
medium
Write a regular expression matching any non-empty binary string containing an EVEN number of '0's and an ODD number of '1's. For instance: '1' (0 zeros, 1 one -> valid), '001' (2 zeros, 1 one -> valid), '010' (valid), '111' (0 zeros, 3 ones -> valid). '01' (1 zero -> invalid), '0011' (2 ones -> invalid). Output only th...
["1", "001", "010", "100", "111", "01011", "10000"]
["", "0", "01", "10", "11", "00", "0011", "0001"]
^(?:(?:00|11)|(?:01|10)(?:00|11)*(?:01|10))*(?:1|(?:01|10)(?:00|11)*0)$
^(0(00)*1(00)*1|(1(00)*0(00)*0))*1(00)*$
We need answer regex. Need solve. Need output only final regex pattern in backticks. Need ensure non-empty binary string, even #0, odd #1. Need avoid ReDoS. Need construct regex. We need think carefully. Language over {0,1}: strings with parity (0 count even, 1 count odd). Non-empty automatically if odd ones >0 so non...
FAIL
0.5714
3
7
8
8
true
0.02
Partial match: 3/7 positive, 8/8 negative passed.
5.93
reflection/Beam-1.0-501B-A23B
automata_03_no_consecutive_identical_chars
Strict Alternating Alphabet String
automata_theory
medium
Write a regex over the alphabet {a, b, c} of length at least 1 such that no two adjacent characters are identical (e.g. 'abacb' is valid, 'abbc' is invalid). Use negative lookahead to strictly forbid identical adjacent characters. Output only the final regex pattern in backticks.
["a", "ab", "aba", "abc", "abacbca", "cbabc"]
["", "aa", "abb", "aab", "abacc", "d", "ab d"]
^(?:([abc])(?!\1))+$
^(?!.*([abc])\1)[abc]+$
We need answer regex over alphabet {a,b,c} length at least 1 such that no two adjacent characters identical. Use negative lookahead to strictly forbid identical adjacent characters. Output only final regex pattern in backticks. Need craft regex. Need likely anchored? "over alphabet ... of length at least 1 such that.....
`^(?!.*([abc])\1)[abc]+$`
PASS
1
6
6
7
7
true
0.04
Fully verified: 100% test pass and ReDoS-immune.
2.1
reflection/Beam-1.0-501B-A23B
lookaround_01_strong_password_rules
Multi-Constraint Password Validation
lookaround_logic
medium
Write a regular expression that validates a strong password with all the following criteria: 1. Length between 10 and 32 characters. 2. At least one uppercase letter [A-Z]. 3. At least one lowercase letter [a-z]. 4. At least one digit [0-9]. 5. At least one special character from [!@#$%^&*]. 6. Must NOT contain the sub...
["CorrectHorse#1", "P@ssw0rdValid!", "SuperSecret99$", "V3ryStr0ng!Key"]
["Short1!", "nouppercase123!", "NOLOWERCASE123!", "NoDigitsHere!", "NoSpecialChar123", "myPassword!123", "adminAccess#2026"]
^(?!.*(?i:password|admin))(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z0-9!@#$%^&*]{10,32}$
^(?!.*(?:[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]|[Aa][Dd][Mm][Ii][Nn]))(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*]).{10,32}$
We need answer regex. Need construct robust, no catastrophic backtracking. Need validate strong password criteria. Need output only final regex pattern in backticks. Need reason carefully. We need regex that matches entire string? Usually validation regex likely anchored. Need include length 10-32, char classes, speci...
`^(?!.*(?:[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]|[Aa][Dd][Mm][Ii][Nn]))(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*]).{10,32}$`
PASS
1
4
4
7
7
true
0.01
Fully verified: 100% test pass and ReDoS-immune.
3.08
reflection/Beam-1.0-501B-A23B
lookaround_02_negative_extension_filter
Filename Filter with Forbidden Extensions
lookaround_logic
medium
Write a regex matching filenames with an alphanumeric name, a dot, and an extension, EXCEPT files with extensions .exe, .bat, or .sh (case-insensitive). Valid examples: 'photo.jpg', 'data.csv', 'archive.tar.gz'. Invalid: 'run.exe', 'script.SH', 'bad.bat'. Output only the final regex pattern in backticks.
["document.pdf", "image.png", "backup.tar.gz", "source.py", "notes.txt"]
["installer.exe", "INSTALLER.EXE", "setup.bat", "deploy.sh", "test.Sh", "noextension"]
^(?!.*(?i:\.(?:exe|bat|sh))$)[a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+)+$
^(?!.*\.(?:[eE][xX][eE]|[bB][aA][tT]|[sS][hH])$)[A-Za-z0-9]+(?:\.[A-Za-z0-9]+)+$
We need answer regex. Need parse problem. Need match filenames with alphanumeric name, a dot, and an extension, except extensions .exe .bat .sh case-insensitive. Valid examples: 'photo.jpg', 'data.csv', 'archive.tar.gz'. Invalid: 'run.exe', 'script.SH', 'bad.bat'. Need output only final regex pattern in backticks. We ...
`^(?!.*\.(?:[eE][xX][eE]|[bB][aA][tT]|[sS][hH])$)[A-Za-z0-9]+(?:\.[A-Za-z0-9]+)+$`
PASS
1
5
5
6
6
true
0.01
Fully verified: 100% test pass and ReDoS-immune.
4.23
reflection/Beam-1.0-501B-A23B
End of preview. Expand in Data Studio

RegexLogic-RLVR: Formal Automata and ReDoS Verification for Beam

RegexLogic-RLVR is an execution-verified reasoning benchmark and synthetic dataset evaluating reflection/Beam-1.0-501B-A23B on formal regular expression synthesis, automata state constraints, and Catastrophic Backtracking (ReDoS) immunity.

Unlike subjective LLM-as-a-judge benchmarks, every model output in this dataset is evaluated by a 4-stage deterministic Python verifier:

  1. Compilation Check: Syntactic validity in Python's standard re engine.
  2. Positive Test Suite: Full acceptance of boundary and complex valid instances.
  3. Negative Test Suite: Strict rejection of edge-case and invalid instances.
  4. ReDoS Attack Simulation: Live execution against exponential backtracking payloads (such as $O(2^n)$ nested quantifiers) under strict wall-clock process timers ($t \le 80\text{ms}$).

Dataset Splits

  1. full_traces: All attempts by reflection/Beam-1.0-501B-A23B across reasoning effort tiers (low vs. medium), containing:
    • Full unedited reasoning_content (internal chain of thought from the model)
    • Extracted candidate regex
    • Stage-by-stage verification metrics (positive pass rate, negative pass rate, ReDoS safety, latency)
    • Diagnostic failure reports
  2. rlvr_prompts: RLVR-ready prompts with ground-truth test specifications, designed for training with Hugging Face TRL (GRPOTrainer).
  3. preference_pairs: Curated DPO / Bradley-Terry preference pairs pairing high-reward, ReDoS-safe patterns against vulnerable or failing generations.

Key Empirical Findings on Beam-1.0-501B

  • The reasoning_effort Parameter: At default or unconstrained effort, Beam can generate over 16,000 characters of deep mathematical reasoning. Setting reasoning_effort="low" or "medium" keeps reasoning disciplined and produces high-accuracy solutions in 2 to 4 seconds without truncation.
  • ReDoS Awareness: When explicitly prompted to avoid catastrophic backtracking, Beam successfully uses unrolled loops (e.g. \w+(?:\s+\w+)* instead of naive (\w+\s*)+) and atomic grouping logic, resisting evil payload attacks that would otherwise hang standard regex engines for >100 seconds.
  • Lookaround Limitations: Beam occasionally assumes unlimited look-behind widths (common in PCRE or .NET), requiring RLVR rewards to guide it toward fixed-width look-behinds supported by Python's native re module.

Benchmark Results

  • Low Effort (low):
    • Accuracy (100% tests passed): 81.2% (13/16)
    • ReDoS Safety Resilience: 100.0% (16/16)
    • Average Latency: 4.00s
  • Medium Effort (medium):
    • Accuracy (100% tests passed): 62.5% (10/16)
    • ReDoS Safety Resilience: 93.8% (15/16)
    • Average Latency: 4.53s

Quickstart

1. Load the Dataset with datasets

from datasets import load_dataset

# Load full verified traces
dataset = load_dataset("yemigraffix/beam-regexlogic-rlvr", "full_traces", split="train")
print(dataset[0]["reasoning_content"])
print(dataset[0]["extracted_regex"])
print("Verifier Reward:", dataset[0]["reward"])

2. Drop-in RLVR Training with TRL GRPOTrainer

This repository includes a standalone reward_fn.py compatible with Hugging Face TRL:

from datasets import load_dataset
from trl import GRPOTrainer, GRPOConfig
from reward_fn import regex_reward_func

dataset = load_dataset("yemigraffix/beam-regexlogic-rlvr", "rlvr_prompts", split="train")

trainer = GRPOTrainer(
    model="your-base-model",
    reward_funcs=[regex_reward_func],
    args=GRPOConfig(
        output_dir="./output",
        learning_rate=1e-5,
        per_device_train_batch_size=4
    ),
    train_dataset=dataset
)

trainer.train()

Benchmark Problem Categories

Category Description Key Focus
redos_defense Refactoring vulnerable expressions (emails, slugs, CSV) $O(n)$ linear matching time; eliminating exponential backtracking
automata_theory Binary divisibility (DFA modulo 3), even/odd parity State-transition correctness and formal language equivalence
lookaround_logic Complex negative assertions, multi-rule password constraints Zero-width assertions without unintended prefix/suffix consumption
structured_data SemVer 2.0.0, strict IPv4 (0-255 octets), ISO-8601, Cron Multi-token numerical range and calendar constraints
syntax_parsing Escaped JSON strings, balanced markdown links Escape sequences and non-greedy delimiters

Ground-Truth Verifier Code

The complete deterministic verification harness is open source in verifier.py. Test it locally:

python verifier.py

Built for the Build with Beam Hackathon organized by Reflection AI and Hugging Face.

Downloads last month
2,574