to get everything in between...
/>(.*?)<\/a>/;
print $1;
the first one doesn't get everything as you expect because the
[^\z] matches one non-EOL char so...
- .* gobbles everything to EOL
- the regex backtracks to match the > (last char on line)
- regex attempts to match a non-EOL char - FAIL - no chars left in string
- regex backtracks to match the previous >
- regex matches a non-EOL char "j" - COMPLETE
the second one just _looks_ for a non-EOL after the match but is zero-width so works as you expect.
hope this helps
larryk
perl -le "s,,reverse killer,e,y,rifle,lycra,,print"
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.