0
PYTHON REGULAR EXPRESSION CURLY BRACES
"Curly braces can be used to represent the number of repetitions between two numbers. The regex {x,y} means "between x and y repetitions of something". Hence {0,1} is the same thing as ?. If the first number is missing, it is taken to be zero. If the second number is missing, it is taken to be infinity." In lesson, I found above mentioned quote. I have a doubt. What if I have to check if certain character say a number 9 is repeated exactly 4 times in a string or not. Then what should I write?? {4,} or {,4} will be taken as minimum 4 times or maximum 4 times. Can I write {4} ?? Just one argument in the braces?? How do you do this?? Thanks in advance!!!
1 Resposta
+ 1
yes, you can... (just try it and see ^^)