Hi, I hope that title was ok - not sure of correct terms to refer to this problem.
So I have a piece of code that is *supposed* to find links containing the phrase "email." and (ultimately with a separate s///) remove them.
Code:
m/<a.+?href=['"].+?email\..*?\/a>/si
Unfortunately what that code does is match everything from the first "<a" tag through to the "</a>" after the "email.".
I'm still relatively new to perl and indeed regex. I've tried messing around with lookbehinds but I can't get my head round them properly, but I suspect they're key to what I need. Any ideas?
This is the data I'm working with:
<a href="detail.jsp?key=7147&rc=d_20071128&p=2&pv=1">Next Page</a><br/
+>
<a class="foot" href="email.jsp?key=7147">E-mail Story</a>
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.