feat: minor regex and casting tests

This commit is contained in:
2026-08-24 17:18:34 +02:00
parent cc4267597e
commit a249667e30
2 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
def run():
print("== Type casting ==")
value = "1234"
value_int = int(value)
print(f"{type(value)} value: {value + str(5)} and {type(value_int)} value: {value_int + 5}")

View File

@@ -3,3 +3,14 @@ import re
def run():
print("== Regular expressions ==")
test_txt = "This is a long test with more test 1234"
matched = re.search("test", test_txt)
print(f"Found span: {matched.span()}, as a group: {matched.group()}")
matched_all = re.findall("^test$", test_txt)
print(f"Found all: {matched_all}")
replaced = re.sub("[(is)*|(it)*]+", "x", test_txt, 7)
print(f"Repalced at: {test_txt} as: {replaced}")