On Oct 22, 7:56 am, [EMAIL PROTECTED] (Michael Alipio) wrote:

> Here's what I came up with:

/\b\w{6,15}\b\n/ && /.*(\d).*\d/ && /(.*([a-z]|[A-Z]).*){4}/)

\b is a word boundary.  It is simply true at spaces in between word
characters and non-word characters.  Your regexps do not at all
preclude special characters from being in your string.

\w is what Perl defines as a "word character".  That is letters,
numbers, AND underscores.  If you don't want underscores, you need to
change them to [a-zA-Z0-9]

Here is an example of a string that your script would allow:
][|2**9($&!abc_defg
it contains between 6 and 15 word characters, followed by a newline
it matches "anything, digit, anything, digit"
it matches "anything-letter" four times.

Not only that, but your solution is simply not well readable.  I
recommend again that you abandon the illogical desire to contrain
yourself to one giant regexp expression.  There is no need for such a
requirement.

Paul Lalli


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to