At 8/22/03 08:42 AM , Chris Santerre wrote:
I'm having a brain freeze right now. Does /w+ match :
ONLY aaaa, bbbbb, ccccc, ect....
or will it also match
abcds, dfgdfg, dsfgrgr, ect.....

The latter. (And I assume you mean \w+, not /w+ .) The \w character is a special character that matches any of [a-zA-Z_0-9]. After the first \w matches (say "a"), the next one (as per the + operator) has no memory of what the first one matched.


If you actually want to match strings that are "the same character repeated over and over again", I think you'd need to use parentheses to remember the first match. Something like: /(\w)\1{3,15}/

If I'm parsing things right, the \w should match any (single) alphanumeric; the parentheses should cause it to be remembered, and the \1 should result meaning "match the same character that the \w matched".

Note that you probably would NOT want to use: /(\w)\1+/ , because then any double-letter will be caught by this regex.

                                                --Kai MacTane
----------------------------------------------------------------------
"I looked Death in the face last night,/I saw him in a mirror,
 And he simply smiled,/He told me not to worry:
 He told me just to take my time."
                                                --Oingo Boingo,
                                                 "We Close Our Eyes"



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to