On Wed, 10 Oct 2007 14:55:22 -0000, it_says_BALLS_on_your forehead
<> wrote:
>> >A B B c A c B d A A
>>
>> >I have a string as represented above. They are separated by spaces of
>> >unknown length. I need to match As and Bs and store them in array in
>> >the order they occur, or as they occur. The array filled from above
>> >string should contain: ABBABAA.
>>
>> my @AandBs = /[AB]/g;
>
>That won't quite work since 'A' and 'B' are representative of more
>complex strings, and so can't fit into a character class.
Then he should have said so. In fact I admit I was in a hurry and
didn't read the rest of his post: somwhat my fault. But then one thing
is to say that the problem is about
A B B c A c B d A A
and later specify that A is not A and B is not B and another thing is
to say so to begin with. However if the problem is not more clearly
defined, one can suppose that
my @AandBs = /one|two or three/g;
will be enough. If the OP wants to exclude a bone and two or
threesome, then he may want to do
my @AandBs = /\b(?

ne|two or three)\b/g;
If he wants something more complicated, then he should say so.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,