     @rootPath       = Encoder.XSSEncode @whereInput.getValue()
     isCaseSensitive = @caseToggle.getValue()
     isWholeWord     = @wholeWordToggle.getValue()
-    # isRegExp        = @regExpToggle.getValue()
+    isRegExp        = @regExpToggle.getValue()
 
     exts            = IDE.settings.editor.getAllExts()
     include         = "\\*{#{exts.join ','}}"
     exclureDirs     = Object.keys IDE.settings.editor.ignoreDirectories
     exclureDirs     = " --exclude-dir=#{exclureDirs.join ' --exclude-dir='}"
 
-    @searchText     = @searchText.replace new RegExp "\\\'", "g", "'\\''"
-    @searchText     = @searchText.replace /-/g, "\\-"
+    searchText = @searchText
+
+    if not isRegExp
+      splitText = searchText.split "\\n"
+      splitText = splitText.map grepEscapeRegExp
+      searchText = splitText.join "\\n"
+
+    searchText     = searchText.replace new RegExp "\\\'", "g", "'\\''"
+    searchText     = searchText.replace /-/g, "\\-"
+
     flags           = [
       '-s'                           # Silent mode
       '-r'                           # Recursively search subdirectories listed.


      @formatOutput res.stdout, @bound 'createResultsView'

  escapeShell: (str) ->
    str.replace /([\\"'`$\s\(\)<>])/g, "\\$1"

  formatOutput: (output, callback = noop) ->
    # Regexes

    flags.splice flags.indexOf('-i'), 1  if isCaseSensitive
    flags.splice flags.indexOf('-w'), 1  unless isWholeWord

    query = "grep #{flags.join ' '} #{exclureDirs} --include=#{include} '#{searchText}' \"#{@escapeShell @rootPath}\""

    vmController.run query, (err, res) =>
      if (err or res.stderr) and not res.stdout
