Skip to content

Commit 8407e57

Browse files
MerricxStefanosChaliasos
authored andcommitted
Fix pipe carret indexing in zkregex rule
1 parent ec32086 commit 8407e57

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/zkregex_fuzzer/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ def check_zkregex_rules_basic(regex: str) -> bool:
4545
if len(regex) > 0 and regex[0] == "^":
4646
allowed_positions.add(0)
4747

48-
# If the string contains '(|^)', that means '^' is at position (idx+2)
48+
# If the string contains '|^', that means '^' is at position (idx+1)
4949
idx = 0
5050
while True:
51-
idx = regex.find("(|^)", idx)
51+
idx = regex.find("|^", idx)
5252
if idx == -1:
5353
break
54-
# '^' occurs at (idx + 2)
55-
allowed_positions.add(idx + 2)
56-
idx += 4 # skip past
54+
# '^' occurs at (idx + 1)
55+
allowed_positions.add(idx + 1)
56+
idx += 2 # skip past
5757

5858
# If the string contains '[^]', that means '^' is at position (idx+1)
5959
idx = 0

0 commit comments

Comments
 (0)