Issue with regex backreference in Python

后端 未结 1 1638
清歌不尽
清歌不尽 2021-01-24 03:10

I am not sure why this is not working. Perhaps I am missing something with Python regex.

Here is my regex and an example string of what I want it to match too:



        
1条回答
  •  情歌与酒
    2021-01-24 03:24

    You have to mark the string as a raw string, due to the \ in there, by putting an r in front of the regex:

    m = re.match(r"<(.*)>phone", "phone")
    

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