If you think of the condition of the number you mentioned as a very simple \d+
... https://regex101.com/r/cnoopg/1
import re
# I think you can just take a screenshot twice
regex = r"(\d+):(\d+)"
test_str = "awfdjaiffewjj33:2d4 324234:3423423 asdfd:fas3"
matches = re.finditer(regex, test_str, re.MULTILINE)
>>> s = "awfdjaiffewjj3324 324234:3423423 asdfdfas3"
>>> for word in s.split():
if ":" in word:
x, y = map(int, word.split(":"))
>>> x
324234
>>> y
3423423
© 2024 OneMinuteCode. All rights reserved.