From: Dv Dasari Date: 2010-11-03T06:05:18+09:00 Subject: Regular Expression I am trying to write a reqular expression to match a word with my input string. Input string can be ( inpstr = ABCDD ) I should be able to match all the below words with 0 or 1 A, 0 or 1 B, 0 or 1 C and 0 or 1 or 2 D A AC CA DAD BAC ADD but not words which have like 2B or 2A AAB ABCC ADDD I am using an expression like ^[ABCDD]*$,but this matches words like ABB or ABCC which have like 2B or 2A. Any suggestion on how I can fix this? Thanks -- Posted via http://www.ruby-forum.com/.