string1 = 'STUDENT001'
string2 = 'STUDENT1111'
the regex - re.match('[\d|\D]{0, 10}', string1) # returns the search - student001
the regex - re.match('[\d|\D]{0, 10}', string2) # returns the search - student111
From the above examples, our expected output is - the pattern matches the string1
and the pattern does not match the string2
because the string2
contains 11 characters
here the pattern matches the length of characters in a range of 0 to 10, but how to mention that this pattern does not allow when the length of characters is more than 10
thanks