REGEX-String and escaped quote

后端 未结 4 1881
你的背包
你的背包 2020-12-19 12:05

How to get what is between the quotes in the following two texts ?

text_1 = r\"\"\" \"Some text on \\\"two\\\" lines with a backslash escaped\\\\\" \\
     +         


        
4条回答
  •  抹茶落季
    2020-12-19 12:27

    Match everything but a double quote:

    import re
    text = "Some text on \"two\" lines" + "Another text on \"three\" lines"
    print re.findall(r'"([^"]*)"', text)
    

    Output

    ['two', 'three']
    

提交回复
热议问题