Hi, I was wondering if anyone has come across a regex that would format a full name. It would make sure that there is a space present between two or more words, only contain letters, hyphens, or a period. If anyone even only knows a good place to search that would be a great help. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shawn Szauksztun-Zvinis wrote:> Hi, > > I was wondering if anyone has come across a regex that would format a > full name. It would make sure that there is a space present between two > or more words, only contain letters, hyphens, or a period.You mean _match_, not "format", right? You''re probably looking for something like this: /(?:[a-zA-Z-.]+(?: |$)){1,}/ This would match a name composed of 2 or more space-seperated words, as per your request. If you want to limit it to match, say, only up to 3 words, use this slight variation: /(?:[a-zA-Z-.]+(?: |$)){1,3}/> If anyone even only knows a good place to search that would be a great > help.Hope that helps, -Alder -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
www.regexplib.com Everything you need. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---