Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用python正则表达式编译模糊正则表达式_Python_Regex_Fuzzy Search_Pypi Regex - Fatal编程技术网

用python正则表达式编译模糊正则表达式

用python正则表达式编译模糊正则表达式,python,regex,fuzzy-search,pypi-regex,Python,Regex,Fuzzy Search,Pypi Regex,当我发现python模块允许模糊匹配时,我越来越高兴,因为它似乎是我许多问题的简单解决方案。 但现在我遇到了一个问题,我没有从文档中找到任何答案 如何使用新的模糊值特性将字符串编译成正则表达式 来说明我通常的需求,并给一个示例一段代码 import regex f = open('liner.fa', 'r') nosZ2f='TTCCGACTACCAAGGCAAATACTGCTTCTCGAC' nosZ2r='AGGTCACATCAACGTCAACG' #nini=regex.compile

当我发现python模块允许模糊匹配时,我越来越高兴,因为它似乎是我许多问题的简单解决方案。 但现在我遇到了一个问题,我没有从文档中找到任何答案

如何使用新的模糊值特性将字符串编译成正则表达式

来说明我通常的需求,并给一个示例一段代码

import regex
f = open('liner.fa', 'r')
nosZ2f='TTCCGACTACCAAGGCAAATACTGCTTCTCGAC'
nosZ2r='AGGTCACATCAACGTCAACG'

#nini=regex.compile(nosZ2r{e<=3})

nimekiri=list(f)
pikkus=len(nimekiri)

count = 0
while (count < pikkus):
    line = nimekiri[count].rstrip('\n')
    m=regex.findall("(TTCCGACTACCAAGGCAAATACTGCTTCTCGAC){e<=3}", line)
    n=regex.findall("AGGTCACATCAACGTCAACG{e<=3}", line) 
    if bool(m) & bool(n):
        print nimekiri[count-1].rstrip('\n')
        print line
    count = count + 1

f.close()


m=regex.findall(“string{e您需要正确地组合字符串

import regex
testString = 'some phrase'
r = regex.compile('('+testString+'){e<=5}')
r.match('phrase')
导入正则表达式
testString='某个短语'
r=regex.compile('('+testString+'){e
m=regex.findall(nini, line) etc.
m=regex.findall("string{e<=3}", line)
import regex
testString = 'some phrase'
r = regex.compile('('+testString+'){e<=5}')
r.match('phrase')