The first example (with z's) are because the pattern is not anchored. What I see is if I do: comPat3=pcreCompile("z{2,5}") pcreExecute(comPat3 "z") ; nil pcreExecute(comPat3 "zz") ; t pcreExecute(comPat3 "zzzzz") ; t pcreExecute(comPat3 "zzzzzz") ; t The pattern is not anchored, so this means it is patching a sequence of 2 to 5 z's anywhere in the string. The last has 5 z's (which match) followed by some other characters, which happen to be a z. You could solve this by doing: comPat3=pcreCompile("^z{2,5}$") which means that the match can ONLY be zz, zzz, zzzz, or zzzzz. Anything else will return nil. Or you might need to make it more complex if you want to allow other characters: comPat3=pcreCompile("(^|[^z])z{2,5}([^z]|$)") This matches either the beginning, or a character other than z, followed by 2 to 5 z's, followed by any character other than z or the end of the string. For your second pattern, the repetition is on the "n" only. So you are asking for something with is Donnnn at least. That's not what you want. comPat1=pcreCompile("(Don\\S*\\s*){4,}") is probably what you want (I've not bothered with anchoring). What this is trying to match is Don followed by any number of non-space characters followed by any number of spaces, and then 4 or more repetitions of all of that (it's in parentheses to group the pattern). Note this is really not related to the implementation in SKILL (other than the \s and \S needing double escapes because of backslash having special meaning in SKILL strings). You could see the same syntax if you did "man perlre" - the syntax is using the Perl Compatible Regular Expression library. Regards, Andrew.
↧