-2

I have been tried to find the something with beautiful soup
But now I'm curious to find the without beautifulsoup

with recompile method How should I find the

import re

</head>  
<body>
<a href="https://programmers.co.kr/learn/courses/4673"></a>#!MuziMuzi!)jayg07con&&

</body>

I tried

re.findall('<body>(.*?)</body>', html, re.DOTALL)

but nothing to find

  • 6
    Read this warning, and beware :) https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – Jeremy Friesner Sep 06 '19 at 00:56

1 Answers1

0

If you have to, it seems it might be just missing the r:

import re

exp = """

</head>  
<body>
<a href="https://programmers.co.kr/learn/courses/4673"></a>#!MuziMuzi!)jayg07con&&

</body>
"""

print(re.findall(r"<body>(.*?)</body>", exp ,re.DOTALL))

Output

['\n<a href="https://programmers.co.kr/learn/courses/4673"></a>#!MuziMuzi!)jayg07con&&\n\n']
Emma
  • 27,428
  • 11
  • 44
  • 69