I've been using s/[ ]+//g; which seems to work effectively on all the varied spacing it's run into. Sticking it into runrigs Bench test as CURIOUS it yields:

Benchmark: running CURIOUS, LEADING, LEADTRAIL, LTSAVE, SEXEGER, SINGL +E_RE, WHILE_RE, each for at least 5 CPU seconds... CURIOUS: 6 wallclock secs ( 5.42 usr + 0.00 sys = 5.42 CPU) @ 39 +780.44/s (n=215610) LEADING: 6 wallclock secs ( 5.29 usr + 0.00 sys = 5.29 CPU) @ 68 +400.00/s (n=361836) LEADTRAIL: 6 wallclock secs ( 5.21 usr + 0.00 sys = 5.21 CPU) @ 28 +325.53/s (n=147576) LTSAVE: 6 wallclock secs ( 5.32 usr + 0.00 sys = 5.32 CPU) @ 30 +798.68/s (n=163849) SEXEGER: 5 wallclock secs ( 5.28 usr + 0.00 sys = 5.28 CPU) @ 50 +426.89/s (n=266254) SINGLE_RE: 6 wallclock secs ( 5.31 usr + 0.00 sys = 5.31 CPU) @ 54 +235.40/s (n=287990) WHILE_RE: 7 wallclock secs ( 5.47 usr + 0.00 sys = 5.47 CPU) @ 34 +396.53/s (n=188149)
coreolyn

In reply to Re: japhy blabs about regexes (again) by coreolyn
in thread japhy blabs about regexes (again) by japhy

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.