+ 12
I do not understand why it must be exactly 4 characters and what is the concrete benefit of "^" and "quot;?
2 Antworten
+ 6
Your ^g forces the first character of the string to be g in order to match. Your y$ forces the last character of the string to be y. Since you only allow two other characters between the g and y, it can only be matched by 4 character strings.
r"^....quot; matches any string that contains exactly 4 characters.
+ 2
It must be 4 characters because you put three definite character and then one unknown between r and y
To have an unlimited amount of characters in between them use .*