diff --git a/src/token.coffee b/src/token.coffee
index 336c45e72..3c6793b98 100644
--- a/src/token.coffee
+++ b/src/token.coffee
@@ -135,9 +135,8 @@ class Token
classes = 'hard-tab'
classes += ' indent-guide' if hasIndentGuide
classes += ' invisible-character' if invisibles.tab
- html = @value.replace StartCharacterRegex, (match) =>
- match = invisibles.tab ? match
- "#{@escapeString(match)}"
+ value = @value.replace(StartCharacterRegex, invisible.tab) if invisible.tab
+ html = "#{@escapeString(value)}"
else
startIndex = 0
endIndex = @value.length