Your regex has entirely too many escapes... except where it needs them:
#!/usr/bin/perl
use strict;
use 5.016;
# 1084488
my $line = '<td align="left"><b>A</b> - Tilt: 19° - Segments: 1(7
+2-93)</td>';
if ($line =~ /<td align="left"><b>A<\/b>\s+-\s+Tilt:\s+\d+&#\d+;\s+-\s
++Segments:\s+(.*?)<\/td>/)
{
say 'yep, good match';
say $1;
} else {
say 'boo';
}
Note that the literal parentheses around the range 72-93 need to be escaped; otherwise they set up a capture. Conversely, you need to parenthesize the whole regex expression (i.e., between the regex delimiters) to capture, as you asked, the whole line... or, if you don't want the html (your OP indicated that's the case) put pairs of capturing parentheses around what you do want (to skip over the closing </b> and to eliminate the closing </td>) in which case, your <c>.+?<c> to match the segment value will need to be more specific or otherwise modified.
Updated by putting that last para, that got lost somewhere :-(, back in the node, and adding the observation re skipping the html.
Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
- code
- verbatim error and/or warning messages
- a coherent explanation of what "doesn't work actually means.
check Ln42!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.