multiple repeat error in python

前端 未结 1 1835
醉话见心
醉话见心 2021-01-19 00:46

I am trying some regexes in python

re.compile(\'in versions: (.+?) of \'+name+\' \')

and, if name is \'libcrypto++\', cause multipl

相关标签:
1条回答
  • 2021-01-19 01:36

    + is a quantifier in regex. So when you add libcrypto++ to regex string, it brings two of them alongside that doesn't make sense. See this.

    To solve this you can use regex escape method, like:

    re.compile('in versions: (.+?) of '+ re.escape(name) +' ')
    
    0 讨论(0)
提交回复
热议问题