G'day Ben,

While it would appear that "2013" may well be a year, take note of the discussion (in this thread) regarding the possibility that it could be part of a telephone number. Then realise that it could, in fact, be part of a street address, a post code, a product ID, a reference number, or anything else that could contain four digits. It may not even be something that appears on any webpage on your website, e.g. '<h2 id="sales-for-2013" ...', '<a href="#sales-for-2013" ...', '<input type="hidden" ...2013... />', etc.

So, you probably don't want to search for "all instances of 2013", but rather more specific strings, e.g. 'Copyright &copy; 2012-2013'.

Continuing the copyright example, you probably don't want to change the 2013 to 2014. Instead, consider changing it to something that evaluates to the current year. Without knowing anything about your website, I can't tell you what that "something" might be: perhaps a function call or a variable; you may need to make the change on every page or, if you're using some sort of template, a single change in one place might suffice.

Of course, because you haven't told us, I actually have no idea what 2013 refers to (although, a year does seem like a reasonable guess). You'll need to determine all the places that 2013 might occur; which are the ones that need changing and which do not; then write your script accordingly. Given that could be quite a large task, and assuming you don't want to have to repeat it in 11 months, you should be motivated to doing it (right) once and never having to worry about it again.

-- Ken


In reply to Re: search and replace by kcott
in thread search and replace by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.