Search code examples
regexbbedit

Is there a truly universal wildcard in Grep?


Really basic question here. So I'm told that a dot . matches any character EXCEPT a line break. I'm looking for something that matches any character, including line breaks.

All I want to do is to capture all the text in a website page between two specific strings, stripping the header and the footer. Something like HEADER TEXT(.+)FOOTER TEXT and then extract what's in the parentheses, but I can't find a way to include all text AND line breaks between header and footer, does this make sense? Thanks in advance!


Solution

  • When I need to match several characters, including line breaks, I do:

    [\s\S]*?
    

    Note I'm using a non-greedy pattern