i want to parse a piece of html with WWW::Mechanize so i used $mech is a WWW::Mechanize object and i have like this piece of string that i want to catch and it seems all methods i tried with regex don't seem to work.

i will paste here the relevant piece of the html i want to parse,and i can say that there are no more pieces like this.

<div style="font-size: 14px; font-weight: bold; border-bottom: 1 +px solid black; margin-bottom: 5px; padding-bottom: 2px;"> Cristina&#39;s Stats <\/div>

now im kind of suspicios on that &#39; that its messing stuff up,but im not sure. ok,we'll talk about this later.

the following is the code ive tried to make to match what we have above

$_=qq/ <div style="font-size: 14px; font-weight: bold; border-bottom: 1 +px solid black; margin-bottom: 5px; padding-bottom: 2px;"> Cristina&#39;s Stats <\/div> /; />.(.*)s Stats.*<\/div>/s; print $1;

now what i am sure of is that it does skip over the endline and that it goes to take the name  Cristina wich is actually what i want the regex to match...well im pretty close to it .im not sure how does WWW::Mechanize come up with &#39; , is this represented as a character or just as a it is in the $mech->content ? (i didnt check that... :| )

hmmm , look how perlmonks displays it : '

the fact is that with the code above the regex works ok, but when faced with the real web content in $mech->content it doesnt work as expected,it doesnt match anything at all.

how can i fix this regex? or what other WWW::Mechanize methods/properties could help to solve the problem?


In reply to regex and WWW::Mechanize parsing a ->content of mechanize object by spx2

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.