I would like to check if a string is of the following regex structure: [0-9]+-[0-9]+
I have the following Python code which, unfortunately, also returns a match when my input string includes the defined pattern and additional characters:
import re
my_string = '100-300'
re.match(r'[0-9]+-[0-9]+', my_string) # returns a match as desired
my_string = 'abc100-300cyd'
re.match(r'[0-9]+-[0-9]+', my_string) # also returns a match
How can I extend my pattern matching so that I only get a match when the pattern is matched and no additional characters are present?