why this regex cannot find the result

后端 未结 3 1696
梦谈多话
梦谈多话 2021-01-21 14:56

I have a python code like below: My question is why the matched variable is [\' \']? (I used the regex in regexpal.com, it can find the right result |Name=A. Johnson | there)

3条回答
  •  花落未央
    2021-01-21 15:53

    matched = re.findall("\|?\s*[nN]ame\s*=([a-zA-Z\.\s]+)\|?",a,re.I)
    print matched
    

    output:

    ['A. Johnson ']
    

提交回复
热议问题