This is untested, but I think this should do the trick:
for($i=0; $i<$glob; $i++){
$_ = @text[$i];
if(/href="?([^">]*)\?eid=/is){
$counter = 1 - $counter;
print $1 if $counter;
}
}
Explanation:
- "?
- The quote mark is optional
- ([^">]*)
- The parens say to snag everything. The [^">]* quantifies 'everything' as being any character that isn't a quote or an end-bracket.
- \?eid=
- This is the key phrase
I'd include more code, but it's prone to errors. The href="? marks the beginning of your search pattern, and the \?eid= marks the end. If it doesn't have an eid, it should return everything within parens to the special regex string $1.
Update: I added the "is" options to the regex to
allow uppercase URLs also. No biggie.
Update 2: Forgot that CODE tags don't need entity substitution, so I had > in one part instead of just >. I fixed it; sorry if I confused anyone.
agermain
"I don't want the world. I just want your half."
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.