           # strip out the regex token from the found phrase (todo, fixme, etc)
           # FIXME: I have no idea why this requires a stupid while loop. Figure it out and/or fix it.
           while (match = regexObj.exec(regExMatch.matchText))
-            regExMatch.matchText = match[1]
+            regExMatch.matchText = match[1].trim()
 
         lookupObj.results.push(e) # add it to the array of results for this regex
 
   renderTodos: ->
     @showLoading()
 
-    #fetch the reges from the settings
+    # fetch the reges from the settings
     regexes = @buildRegexLookups(atom.config.get('todo-show.findTheseRegexes'))
 
-    #@FIXME: abstract this into a separate, testable function?
+    # @FIXME: abstract this into a separate, testable function?
     promises = []
     for regexObj in regexes
-      #scan the project for each regex, and get a promise in return
-      promise = @fetchRegexItem(regexObj)  #inspect -> {state: 'pending'}
-      promises.push(promise) #create array of promises so we can listen for completion
-
+      # scan the project for each regex, and get a promise in return
+      promise = @fetchRegexItem(regexObj)
+      promises.push(promise) # create array of promises so we can listen for completion
 
     # fire callback when ALL project scans are done
     Q.all(promises).then () =>

            return atom.project.relativize(data);
          ).render(bodies.block, context).untap();
        ,
        "results": regexes #FIXME: fix the sort order in the results
        # "todo_items": todoArray,
        # "fixme_items": fixmeArray,
        # "changed_items": changedArray,


    return regexes

  # Pass in string and returns a proper RegExp object
  makeRegexObj: (regexStr) ->
    # extract the regex pattern
    pattern = regexStr.match(/\/(.+)\//)?[1] #extract anything between the slashes
    # extract the flags (after the last slash)
    flags = regexStr.match(/\/(\w+$)/)?[1] #extract any words after the last slash. Flags are optional

    # abort if there's no valid pattern
    return false unless pattern

    return new RegExp(pattern, flags)

  # Scan the project for the regex that is passed
  # returns a promise that the project scan generates
  # @TODO: Improve the param name. Confusing
  fetchRegexItem: (lookupObj) ->
    regexObj = @makeRegexObj(lookupObj.regex)

    # abort if there's no valid pattern
    return false unless regexObj

    # handle ignores from settings
    ignoresFromSettings = atom.config.get('todo-show.ignoreThesePaths')
    hasIgnores = ignoresFromSettings?.length > 0
    ignoreRules = ignore({ ignore:ignoresFromSettings });
    
    return atom.workspace.scan regexObj, (e) ->
      # check against ignored paths
      include = true
      pathToTest = slash(e.filePath.substring(atom.project.getPaths()[0].length))
      if (hasIgnores && ignoreRules.filter([pathToTest]).length == 0)
