2Patrick C
Thank you for your code, which is the solution for my example above.
Your example also finds the number 42 – this should not be found.

I don’t know if there is a solution:
Only 2 and 4 should be found, i.e. exactly:2 and exactly:4.

If there are any combinations in which the numbers 2 and 4 are contained,
such as 1024, 42, 4242, 1524, 2415, 124215, 754224, etc., then the numbers should not be found/marked.

regex101 dot com is also my favorite site because it offers explanations – but I am a complete beginner…