Extract string with Python re.match

后端 未结 4 862
盖世英雄少女心
盖世英雄少女心 2020-12-01 14:16
import re
str=\"x8f8dL:s://www.qqq.zzz/iziv8ds8f8.dafidsao.dsfsi\"

str2=re.match(\"[a-zA-Z]*//([a-zA-Z]*)\",str)
print str2.group()

current result=> error
expec         


        
4条回答
  •  旧时难觅i
    2020-12-01 14:48

    output=re.findall("(?<=//)\w+.*(?=/)",str)
    
    final=re.sub(r"[^a-zA-Z0-9]+", "", output [0])
    
    print final
    

提交回复
热议问题