I would like to do something like the following:
if params[:entry].include? ("http" || "www" || "com" || "abc" || "def")
...
end
I tried using regex but it didn’t work (can’t convert regex to string) and I need the statement to return true if the strings we’re searching for appear anywhere in params[:entry].
What is the best way to do this using Ruby / Rails?
Wouldn’t
params[:entry].match(/(http|www|com|abc|def)/)do the trick?String pattern to regexp – String#match