regex - Ruby Format Validations [ No Whitespace ] -
regex - Ruby Format Validations [ No Whitespace ] -
i'm trying create format validation text field reject whitespace. can help me out regex syntax? i've tried:
no_whitespace = /\a[\s]\z/i validates :customurl, :format => { :with => no_whitespace } i'm new programming , clueless regex. help appreciated. thanks!
try this:
no_whitespace = /^[\s]+$/ that should specify no whitespace characters origin (^) the end ($) of string, , @ to the lowest degree 1 character.
ruby-on-rails regex validation models
Comments
Post a Comment