html Regex Games: Level 2: Challenge 1 - Answer Page

Regex Games Level 2: Challenge 1 - Answer

			import re

def find_all_matches(pattern, string):
    return [match.start() for match in re.finditer(pattern, string)]

# Example usage
string = '12345'
pattern = '\d'
print(find_all_matches(pattern, string))
		

Well, you made it to Level 2! You've managed to find all the matches. But don't get too cocky, because in Level 3, you'll be facing some truly diabolical regular expressions.

Here's a little hint for you: Level 3 is going to involve some sneaky Unicode escape sequences.

Good luck!

Or, you know, don't. We're not really invested in your emotional well-being.