I want to ask a question about regular expression. I want to extract the cases that include only the certain characters.
For example, in the following vector, I want to extract the cases that only include A or B.
d[!grepl('[^AB]', d)] #  "AAAAAA" "BBBBBBBBB" "ABAABAAA" "ABA" "ABABABA"
which says, exclude all the elements in
d that contain anything other than "A" or "B".