On Fri, Nov 16, 2001 at 10:39:57PM +0100, birgit kellner wrote: > 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.
The description of what you what and what strings you wish discarded don't match. You say you want to filter out strings that contain two non-identical capital letters; that would discard $string1 and $string3. $string1 contains two non-identical capital letters, "AB"; $string3 contains two non-identical capital letters, "AB"; and to filter is to remove. Assuming that your description was wrong, and that your wish for which gets discarded is correct, I came up with: foreach (qw(ABCD AbCd AABcD)) { print if !/([[:upper:]])\1/ && /[[:upper:]]+/ } You can replace the class [:upper:] with A-Z if your perl doesn't support it. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]