If you look at his original email, if any small letters, don't want and if mutliple
Capital letters in a row, don't want either only capital letters which do not have two
or more in a row of same character.
SO ABCD is ok, but ABcD fails on small letter. ABBCD fails on 2 B's together.
Wags ;)
-----Original Message-----
From: Andrea Holstein [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 17, 2001 11:58
To: [EMAIL PROTECTED]
Subject: Re: capture strings with two non-identical capital letters in a
row
>
> my $string1 = "ABCD";
> my $string2 = "AbCd";
> my $string3 = "AABcD";
>
> Get $string1, discard $string2 and $string2.
>
> ...
> but ABBC displays as valid!
>
> Wags ;)
What's the difference between "AABcD" and "ABBC" ?!
However, I wrote a little script with two different possibilities:
my @strings = qw/ ABCD AbCd AABcD ABBC /;
foreach (@strings) {
print;
# find 2 or 3 different capitals in a row
/ ([[:upper:]])
(?!\1) ([[:upper:]])
(?!\1|\2) ([[:upper:]]) /x ? print " valid, " : print " invalid, ";
# find 2 or 3 different capitals in row, where
# same capitals count as one
s/ ([[:upper:]])\1* /\1/gx;
/ [[:upper:]]{2,3} /x ? print " valid($_)\n" : print " invalid($_)\n";
}
It produces the output:
ABCD valid, valid(ABCD)
AbCd invalid, invalid(AbCd)
AABcD invalid, valid(ABcD)
ABBC invalid, valid(ABC)
Hope, it helps.
Best Wishes,
Andrea
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]