What you probably want is something like s/copyright.*$/$&, 2005/g. I would really try to narrow the search string down some more though.
Since you have "copyright*" as the match string, you are matching copyright or copyrightttt or copyrightttttt, but not "copyright 2003-2004" so the operator you are doing just leaves the rest of the string alone and only works with the part that matches. That is why you get the doubling up of 2003-2004.
If you want to match "copyright 2003-2004" or basically copyright-to-the-end-of-the-line, then use "copyright.*$" to get it all. If not, then build a match that includes the numbers too.
The dot-star bit is bad and should be eliminated. You should look at your data and build a better match. See Death to Dot Star! for more.
Some of my details on the exact matching might be a little off, I'm still just a learner on regex's too.
-Kurt
Update: ++demerphq for an even better explanation.
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.