in reply to Shortest way to replace a string

perl -pE"s[30\.00\.\d\d\.\d\d][30.00.00.00]g;" infile > outfile

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Shortest way to replace a string
by choroba (Cardinal) on Sep 11, 2013 at 23:08 UTC
    Or
    s/(?<=30\.00\.)[0-9][0-9]\.[0-9][0-9]/00.00/g
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      The spec was "shortest" and that's 10 keystrokes longer; and certainly no more efficient :)


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        Short? How about this?

        s/^(30\.00).*? /$1.00.00 /;

        UPDATE: Added the missing space in the "replace" bit.

        It does not match ٧, though.
        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ