Search code examples
pythonregexcapturing-group

Capturing regular expression in Python


I would like to use the regular expressions in Python to get everything that is after a </html> tag, an put it in a string. So I tried to understand how to do it in Python but I was not able to make it work. Can anyone explain me how to do this ridiculous simple task ?


Solution

  • m = re.match(".*<\html>(.*)",my_html_text_string)
    print m.groups()
    

    or even better

    print my_html_string.split("</html>")[-1]