From: Richard Conroy Date: 2010-11-03T06:34:08+09:00 Subject: Re: Regular Expression --0022150481037d68ce049418aec6 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Nov 2, 2010 at 9:05 PM, Dv Dasari wrote: > I am trying to write a reqular expression to match a word with my input > string. > > Input string can be ( inpstr = ABCDD ) > > Any suggestion on how I can fix this? > You are going to need some more advanced regexes to get a match in the way you are hoping for. I would get out a copy of a good regex cheat sheet, and work through some examples in http://rubular.com http://www.addedbytes.com/download/regular-expressions-cheat-sheet-v2/pdf/ The main reason for rubular is that you list all of the regexes you want to match, and which to reject, and keep tweaking until you get what you want. OTOH this regex might scratch your itch: /^A?B?C?D{0,2}$/ -- http://richardconroy.blogspot.com | http://twitter.com/RichardConroy --0022150481037d68ce049418aec6--