On Fri, Feb 11, 2011 at 11:30 AM, Rodrigo Alves Vieira
<rodrig...@gmail.com>wrote:

> Hello everyone, in my Rails app I need to validate a string that on
> creation can not have its first chars empty or composed by any special
> chars.
>
> For example: " file" and "%file" aren't valid. Do you know what Regex I
> should use?
>
You could utilize the "anchor" for this -- that is you say that the line
must "begin" with the characters that match the following regex.
Something like: /\A[\w]+$/ would work.


> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to