Kodi Community Forum

Full Version: Regex are greedy? / extracting content from multiple lines
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone.

I've started to build a movie scraper and extraction of content like that works:
<h1 class="text-serif">LORD OF THE RINGS</h1>

However, extraction of content from multiple lines does not work as expected.
        <a href="/person/filme/2358">
            Ralph Bakshi
        </a>
Corresponding regex, not escaped:
Code:
<a href="/person/filme/.*">(.*)</a>

That regex does not stop at the closing </a> tag but include much more text until some other closing </a> tag.
So I guess the regex is greedy. Is there a way I can change that?
Alternatively, is there a way I can match whitespace and line breaks in the regex? I wasn't successful then trying.

Thank you,
Ben
Use .*? to stop after first match.
Great tip! Thanks a lot!
(I'll open another thread for my next question)
Thread marked solved.