regural expression with not condition.



Hi all,

i'm trying validate the format which doesn't consist of an empty string
in the single or double quotes.

validates_format_of :name,:with=>/^['"][ ]*['"]$/ ,:on=> :create

/^['"][ ]*['"]$/ it does validation for like the string ' ' and " " . i
need except this like the string may contain "vamsi" or 'vamsi' or
"vamsi's" all these three are valid for me.

so how to modify the above expression is there any thing like
:without? (ofcourse there is no)

or can we put a not condition for the regular expression
like !(/^['"][ ]*['"]$/)


Thanks
VK.
--
Posted via http://www.ruby-forum.com/.

.



Relevant Pages

  • regular expression question
    ... Is it possible for a regular expression to macth only an empty string? ... but that causes the parser to throw an exception - ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Problem with the $ sign by Match String
    ... In a regular expression, ... So, when you tried to match the regular expression $, you were trying to match to an empty string at the end, which is why your function failed.  When you enter \$, the regular expression treats the $ as a character. ...
    (comp.lang.labview)
  • regular expression
    ... How do i incorporate empty string requirement into the regular expression? ...
    (microsoft.public.dotnet.languages.csharp)

Loading