Google's your friend here. "validate url with regular expression".
-----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Joe Peck Sent: Wednesday, October 15, 2008 7:45 AM To: [email protected] Subject: [Rails] Small regular expression question I'm looking to write a regular expression that will match valid URLs. My problem is that it almost works, except it accepts URLs with / in the middle of them, suchs as: http://www.ruby/rails.com It looks (to me) like my regular expression should not match strings like that, but it does. Here is the regular expression: .match(/^((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.(\w+).*$/ix) How can I make it not accept URLs with / in the middle of them? -- 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

