Or without explicit capturing or evaluation (or rounding!) (update: and with dynamic control of truncation threshold), but needs Perl version 5.10+ for  \K operator:

c:\@Work\Perl\monks>perl -wMstrict -le "use 5.010; ;; my $content = qq/{ \"geometry\": { \"type\": \"Polygon\", \"coordinates\": [ [ +[ 19.05480 4912278406, \n/ . qq/47.485785556135411 ], [ 19.057857836771483, 47.487322542030711 + ], [ 19.06025597925397, \n/ . qq/47.488491565765209 ], [ 19.060347248086835, 47.488539642204628 + ], [ 19.060463310421543, \n/ . qq/47.484578287406251 ], [ 19.054804912278406, 47.485785556135411 + ] ] ] } } \n/ ; print qq{[[$content]]}; ;; my $n = 7; $content =~ s{ \d [.] \d{$n} \K \d+ }{}xmsg; ;; print qq{<<$content>>}; " [[{ "geometry": { "type": "Polygon", "coordinates": [ [ [ 19.054804912 +278406, 47.485785556135411 ], [ 19.057857836771483, 47.487322542030711 ], [ 19 +.06025597925397, 47.488491565765209 ], [ 19.060347248086835, 47.488539642204628 ], [ 19 +.060463310421543, 47.484578287406251 ], [ 19.054804912278406, 47.485785556135411 ] ] ] } + } ]] <<{ "geometry": { "type": "Polygon", "coordinates": [ [ [ 19.0548049, 47.4857855 ], [ 19.0578578, 47.4873225 ], [ 19.0602559, 47.4884915 ], [ 19.0603472, 47.4885396 ], [ 19.0604633, 47.4845782 ], [ 19.0548049, 47.4857855 ] ] ] } } >>


Give a man a fish:  <%-{-{-{-<


In reply to Re^2: In-place regex substitution by AnomalousMonk
in thread In-place regex substitution by lmocsi

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.