Created
July 9, 2021 10:39
-
-
Save neerajvashistha/8b67b13cb43ab9fed2bb9c881adab3bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_next_index(a_string:str, substring:str)->list: | |
""" | |
return find all index of a substring in a_string in a list | |
""" | |
raw_substring = r'\b{0}\b'.format(substring) | |
matches = re.finditer(raw_substring, a_string) | |
matches_positions = [match.start() for match in matches] | |
return matches_positions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment