 
 # A base class for common regexp-based matching engines.
 class RegexpEngine
-  constructor: (args...) -> @regexps = args
+  constructor: (args...) -> @regexps = args.map (regexp) -> new RegExp regexp
   match: (searchUrl) -> Utils.matchesAnyRegexp @regexps, searchUrl
 
 # Several Google completion engines package XML responses in this way.

# then strip "map of" from the resulting suggestions.
class GoogleMaps extends GoogleWithPrefix
  # Example search URL: https://www.google.com/maps?q=%s
  constructor: -> super "map of", new RegExp "https?://[a-z]+\.google\.(com|ie|co\.uk|ca|com\.au)/maps"

class Youtube extends GoogleXMLRegexpEngine
  # Example search URL: http://www.youtube.com/results?search_query=%s
  constructor: ->
    super new RegExp "^https?://[a-z]+\.youtube\.com/results"

  getUrl: (queryTerms) ->
    Utils.createSearchUrl queryTerms,

class Wikipedia extends RegexpEngine
  # Example search URL: http://www.wikipedia.org/w/index.php?title=Special:Search&search=%s
  constructor: ->
    super "^https?://[a-z]+\.wikipedia\.org/"

  getUrl: (queryTerms) ->
    Utils.createSearchUrl queryTerms,
