compiling a fuzzy regexp with python regex

前端 未结 1 726
旧时难觅i
旧时难觅i 2021-01-14 11:06

When I found out that the python regex module allows fuzzy matching I was increasingly happy as it seemed as a simple solution to many of my problems. But now I am having a

相关标签:
1条回答
  • 2021-01-14 11:27

    You need to put your strings together correctly.

    import regex
    testString = 'some phrase'
    r = regex.compile('('+testString+'){e<=5}')
    r.match('phrase')
    

    If you want to build a regex pattern, you'll need to use various string manipulation techniques to build up the appropriate pattern to use.

    0 讨论(0)
提交回复
热议问题