O monks: I have a regular expression conundrum that seems to be platform related. The company that I am working for has some scripts that process documents, and in order to ship them for windows, we compile a perl (5.005.03) so that we can qa with a known version. I am noticing that a regular expression which runs very quickly on linux takes considerably longer running on Win 2k. The part of the regular expression which I am looking at changing is this:
(?:\w[\.\w\-\'\!\(\)\/\]|[ ])+

I tried removing the alteration, thusly:
(?:\w[\.\w\-\'\!\(\)\/]+[ ]?)+

but got about the same speed.
However, removing the clustering:
(\w[\.\w\-\'\!\(\)\/ ])+

speeded this up considerably on Win32 and screams on linux. (This is a partial section of a long regex, but this is the section that was changeable).

My question, then, is: Do any monks have experience with speed differences of regular expressions under Windows, or compilation suggestions that would improve things. Thanks in advance, Blkstrat


In reply to Speed of regex on compiled perl under windows by blkstrat

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.