Okay, at one level it is a user/data error. However, it highlights another potential bug in Regex::List, namely that it should escape regex special characters where they appear in literals. Unless it is meant to allow you to pass in regexes for mangling as well?

With respect to what you are trying to achieve, you'll have to read the docs for the module, but if it doesn't have it's own syntax (I haven't looked), for specifying "this literal or an abbreviation of with a minimum of N chars", you would probably have to repeat all of the possibilities in the input?

If it does allow you supply part regexes in the input data, then you'd have to reverse the ordering of your alternation above as they are matched left to right, and if you put the shortest first, that will always be match leaving the rest of any longer match redundant and so prevent matching of the entire string. You'd also need to group them. Ie.

create (?:procedure|procedur|procedu|proced|proce|proc)

That said, if this is SQL, then I think most variants will either accept create proc or create procedure, but not the other intermediate abbreviations, in which case you would just want

create proc(?:edure)?

As I indicated--assuming it will let you do that. If not, supplying a case for both alternatives fully spelt out should allow it to derive the above for itself.

I'd be very wary of it not escaping regex special chars though.

I've also had a go at trying to make the regex you posted match a simple string of 'insert' or 'update', and it doesn't, though I haven't worked out why. It looks cursorily like it ought to, but I haven't expended a huge amount of effort trying to unwind it's convolutions. Maybe you should consider one of the other alternatives--or at least compare the results they produce.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^3: Most recent pattern match by BrowserUk
in thread Most recent pattern match by Anonymous Monk

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.