From: Justin Collins Date: 2009-07-14T18:38:57+09:00 Subject: Re: a regex that does not contain comma Sijo Kg wrote: > Hi > Could anybody please tell how to write the validates_format_of a > string(in rails) which is only valid when it does not contain a > comma.For example > > The are valid > > hi welcome > Hello > h123 kk > hh gg hh > > The are not valid > > Hello, > Hi , world > Hello,welcome > > Thanks in advnce > Sijo > I believe /^[^,]*$/ will do what you need, including matching empty strings. rubular.com is a good place to try out regular expressions. -Justin