I was revisiting Negating Regexes: Tips, Tools, And Tricks Of The Trade and caused perl to segfault with one of the patterns I tried. I reduced the pattern to he simplest form that still causes a problem. Tested with:
This is perl, v5.8.7 built for i486-linux-gnu-thread-multi Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT

This works:

"1" =~ qr[(??{/^1/})]
This segfaults
"<" =~ qr[(??{/^</})]
Segfault re=debug output:
Freeing REx: `","' Compiling REx `(??{/^</})' size 4 Got 36 bytes for offset annotations. Compiling REx `^<' size 4 Got 36 bytes for offset annotations. first at 2 1: BOL(2) 2: EXACT <<>(4) 4: END(0) anchored `<' at 0 (checking anchored) anchored(BOL) minlen 1 Offsets: [4] 1[1] 2[1] 0[0] 3[0] first at 1 1: LOGICAL[2](2) 2: EVAL(4) 4: END(0) minlen 0 with eval Offsets: [4] 10[0] 10[0] 0[0] 11[0] Matching REx `(??{/^</})' against `<' Setting an EVAL scope, savestack=15 0 <> <<> | 1: LOGICAL[2] 0 <> <<> | 2: EVAL re_eval 0x8153fe8 Guessing start of match, REx `^<' against `<'... Guessed: match at offset 0 Matching REx `^<' against `<' Setting an EVAL scope, savestack=15 0 <> <<> | 1: BOL 0 <> <<> | 2: EXACT <<> 1 <<> <> | 4: END Match successful! Compiling REx `1' size 3 Got 28 bytes for offset annotations. first at 1 1: EXACT <1>(3) 3: END(0) anchored `1' at 0 (checking anchored isall) minlen 1 Offsets: [3] 1[1] 0[0] 2[0] Entering embedded `1' Setting an EVAL scope, savestack=21 0 <> <<> | 1: EXACT <1> failed... Freeing REx: `"1"' failed... Setting an EVAL scope, savestack=24 1 <<> <> |50339: LOGICAL[2] 1 <<> <> |50340: EVAL
Is this fixed in later perls?

In reply to regex bug in perl 5.8.7 by imp

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.