Here is a shot using both regex and a for loop: sub checker { local $_ = $_[0]; # pass the data to be checked return 0 if ( /[^A-Z]/ ); # if not capital letters, get out my $MyResult = 1; my @worka = split(//,$_); # split out all the characters one each into an array for(my $MyId=0;$MyId<@worka;$MyId++) { my $MyId1 = $MyId + 1; last if ( $MyId1 == @worka ); # if the next id equals @worka, then done and unique if ( $worka[$MyId] eq $worka[$MyId1] ) { # any equal characers in a row $MyResult = 0; last; } } return $MyResult; } Maybe can be done by regex, but not that great and will to any gurus whoc can backtrack 1 character after a test.
Wags ;) -----Original Message----- From: birgit kellner [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 13:40 To: [EMAIL PROTECTED] Subject: capture strings with two non-identical capital letters in a row How can I filter out strings which contain two (or three) non-identical capital letters in a row? my $string1 = "ABCD"; my $string2 = "AbCd"; my $string3 = "AABcD"; Get $string1, discard $string2 and $string2. Birgit Kellner -- 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]