       return null
     return x
   calculate: (spelling) ->
-    if spelling.text.match @pattern
+    if @pattern.test spelling.text
       []
     else
       [spelling]

enhancedRegexpReplace = (str, left, right) ->
  str = str.replace left, right
  caseChangeExpr = /\\([UL]).*?(\\E|$)/
  if right.search(caseChangeExpr) != -1
    while str.search(caseChangeExpr) != -1
      str = str.replace caseChangeExpr, (text) ->
        if text.slice(0, 2) == '\\U'
          caseChange = String::toUpperCase

  query: (pattern) ->
    s = new Script
    for k, v of @mapping
      s.mapping[k] = v if pattern.test k
    s

  queryPrevious: (previous) ->
