aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/cmd/search.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index d5a826eda..98031fe7b 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -61,7 +61,16 @@ module Homebrew
end
end
end
-
+ metacharacters = %w[\\ | ( ) [ ] { } ^ $ * + ? .]
+ bad_regex = metacharacters.any? do |char|
+ ARGV.any? do |arg|
+ arg.include?(char) && !arg.start_with?('/')
+ end
+ end
+ if ARGV.any? && bad_regex
+ ohai "Did you mean to perform a regular expression search?"
+ ohai "Surround your query with /slashes/ to search by regex."
+ end
raise SEARCH_ERROR_QUEUE.pop unless SEARCH_ERROR_QUEUE.empty?
end