Skip to content

Instantly share code, notes, and snippets.

@eoftedal
Created May 23, 2012 12:16
Show Gist options
  • Save eoftedal/2774937 to your computer and use it in GitHub Desktop.
Save eoftedal/2774937 to your computer and use it in GitHub Desktop.
Based on @homakov's work
a = "javascript:evil();\nhttp://www.vg.no"
if a =~ /^https?/ then
puts "This is a safe url starting with http or https"
end
@eoftedal
Copy link
Author

Regexp are by default in multiline mode in ruby, meaning validation doesn't work as intended.

@eoftedal
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment