Take the 2-minute tour ×  can you help me with this:  I want a
regular expression for my Ruby program to match a word with the
below pattern  Pattern has    1. List of letters ( For example.
ABCC => 1 A, 1 B, 2 C )   2. N Wild Card Charaters ( N can be 0
or 1 or 2)   3. A fixed word (for example “XY”).     1.
Regarding the List of letters, it should match words with
a. 0 or 1 A      b. 0 or 1 B      c. 0 or 1 or 2 C    2. Based
on the value of N, there can be 0 or 1 or 2 wild chars   3.
Fixed word is always in the order it is given.   4. The
combination of all these can be in any order and should match
words like below  ABWXY ( if wild char = 1)    But not words
with 2 A’s or 2 B’s  I am using the pattern like ^[ABCC]*.XY$
But it looks for words with more than 1 A, or 1 B or 2 C's and
also looks for words which end with XY, I want all words which
have XY in any place and letters and wild chars in any postion.
share|improve this question add comment  4 Answers  up vote 1
down vote accepted  I consider m