0

I was learning about regex and found out that + and the {1,} have the same function. What I was wondering is whether there is any difference between the two?

I tried finding out the execution times by copying a standard passage and executing the regex patterns using the above two operators. I found out that the execution time for {1,} was faster than that of +. Can anyone explain why?

pattern1 = r'/[A-Z]{1,}/g'
pattern2 = r'/[A-Z]+/g'
Barmar
  • 596,455
  • 48
  • 393
  • 495
T.Square
  • 201
  • 2
  • 9

0 Answers0