🐐 QVAERE

This commit is contained in:
2026-04-22 09:08:36 +02:00
parent ebea9f942b
commit b9a1ed1bcc
12 changed files with 84 additions and 281 deletions

View File

@@ -1277,6 +1277,19 @@ class BuiltIn(Node):
with open(path, "a") as f:
f.write(content)
return vtable, ValNul()
case "QVAERE":
pattern = params[0]
text = params[1]
if not isinstance(pattern, ValStr) or not isinstance(text, ValStr):
raise CentvrionError("QVAERE requires two strings")
try:
matches = [
ValStr(m.group(0))
for m in re.finditer(pattern.value(), text.value())
]
except re.error as e:
raise CentvrionError(f"Invalid regex: {e}")
return vtable, ValList(matches)
case _:
raise NotImplementedError(self.builtin)