The patterns are read from a file and pushed into the array upon which the regex list is built. The file contains this
create pro[cedure]
Perhaps it's an incorrect definition on my part . I wanted it to match in the way that you have specified i.e. like this
create proc|proce|proced|procedu|procedur|procedure
| [reply] [d/l] [select] |
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.
| [reply] [d/l] [select] |