in reply to Re^3: How to extract a pattern in Perl regex?
in thread How to extract a pattern in Perl regex?

Mojo::DOM makes parsing fun and simple.

Agreed, and ojo makes it even more fun ;-)

$ perl -Mojo -e 'say g("https://perlmonks.org")->dom->at("title")->all +_text=~s/^\s+|\s+$//gr' PerlMonks - The Monastery Gates

Replies are listed 'Best First'.
Re^5: How to extract a pattern in Perl regex?
by marto (Cardinal) on May 02, 2020 at 09:26 UTC

    ojo is very nice, but I find myself more often writing programs that just aren't practical as one liners

      I find myself more often writing programs that just aren't practical as one liners

      Same here. My reaction was inspired by this: 'However part of my question was how do I extract in one statement what's in between the "title tags". ... Surely there's a simpler way?' I think one of the things that turns people off from using modules instead of plain regexes is because modules often require a lot of boilerplate, which luckily Mojolicious for the most part does not.

        Indeed, I took that to mean do it within one line of code, rather than as a command line one liner.