So here is my simplified code, and at the bottom is just a bit of the data in the $tagl scalar.

my $tagl = $resp->decoded_content; if($tagl =~ /<div class=\"soda.*?>(.*?)<\/div>/ism) { say "inside"; my $grp = $1; say $grp; }

I know I get a match, because I do get the "inside" msg. But $1 is nothing. Am far from an expert in regex, but have used this before and I have no idea why I get the match, but not the group to extract. I made the pattern match in RegEx101.com, and in there it works. And yes, I know I will have to trim the extra whitespaces, but I can't even extract the group right now.

If anyone knows what I'm missing.....thank you in advance.

I post the data in a code format because it comes out cleaner here

</div> </div> <div id="taglines_content" class="header"> <div class="header"> <div class="nav"> <div class="desc">Showing all +3 taglines</div> </div> </div> <div class="soda odd"> Power. Grace. Wisdom. Wonder. </div> <div class="soda even"> Wonder. Power. Courage. </div> <div class="soda odd"> The future of justice begins w +ith her </div> </div> </div> <div class="article" id="see_also"> <h2>See also</h2> <p> <span class="nobr"> <a href="/title/tt0451279/plotsumm +ary?ref_=tttg_sa_1" class="link">Plot Summary</a> <span class="ghost">|</span> </span> <span class="nobr"> <a href="/title/tt0451279/synopsis +?ref_=tttg_sa_2" class="link">Synopsis</a> <span class="ghost">|</span> </span> <span class="nobr"> <a href="/title/tt0451279/keywords +?ref_=tttg_sa_3" class="link">Plot Keywords</a> <span class="ghost">|</span> </span> <span class="nobr"> <a href="/title/tt0451279/parental +guide?ref_=tttg_sa_4" class="link">Parents Guide</a> </span> </p> </div> <script> if ('csm' in window) {

In reply to I match a pattern in regex, yet I don't get the group I wanted to extract for some reason by SergioQ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.