The \t metacharacter matches a horizontal tab (HT, U+0009)—the character inserted when you press Tab. It is essential for parsing TSV files, cleaning pasted spreadsheet data, and handling column-aligned text.
01
Tab char
\t
02
U+0009
HT control
03
TSV
split(/\t/)
04
In \s
Whitespace
05
Replace
Tabs → spaces
06
vs space
Not the same
Fundamentals
Introduction
When you copy data from a spreadsheet or export a TSV file, columns are often separated by tab characters rather than commas. The \t metacharacter lets your regex target those separators precisely.
Unlike spaces, a tab is a single control character. In regex, /\t/ matches exactly one tab—not multiple spaces and not other whitespace types unless you use the broader \s class.
Concept
Understanding the \t Metacharacter
\t matches the horizontal tab character (Unicode U+0009). In JavaScript string literals, "\t" creates the same character that /\t/ matches in a regex.
For TSV files, split rows on \n first, then columns on \t.
Do not confuse \t (horizontal) with \v (vertical tab).
Compatibility
Browser & Runtime Support
The \t tab metacharacter is part of core JavaScript regular expression syntax.
✓ Baseline · ES3+
RegExp \t
Supported in every browser and Node.js version. \t matches the horizontal tab control character.
99%Universal syntax
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
\tExcellent
Bottom line: Safe everywhere. Use \t when you need tab-specific parsing beyond general \s whitespace.
Wrap Up
Conclusion
The \t metacharacter matches the horizontal tab character (U+0009). It is essential for parsing TSV data, cleaning pasted spreadsheet content, and detecting tab-based indentation.
Use split(/\t/) for columns, /\t/g with replace() to normalize separators, and remember that tab is not the same as a space. Next, learn the \uXXXX Unicode escape metacharacter.
Use \s when any whitespace separator is acceptable
❌ Don’t
Assume spaces and tabs are interchangeable
Split on space when data uses tab delimiters
Forget the global flag when replacing all tabs
Confuse \t with \v (vertical tab)
Expect visual column alignment to equal character count
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about RegExp \t
Match the horizontal tab character for TSV and column data.
5
Core concepts
📝01
Tab
\t
Syntax
📈02
U+0009
HT code.
Unicode
🚫03
split()
TSV cols.
Parse
🔒04
/\t/g
Replace.
Normalize
🔢05
\s
Includes tab.
Related
❓ Frequently Asked Questions
\t matches the horizontal tab character (HT, Unicode U+0009, ASCII 9). It is the control character produced by the Tab key in most text editors.
No. A tab is a single character with a fixed code point. Visually it may align to column stops, but in regex it matches exactly one tab—not a run of space characters.
Yes. Horizontal tab is included in the \s whitespace class along with space, newline, carriage return, form feed, and vertical tab.
Use split with a tab pattern: row.split(/\t/). For a full file, split lines first with /\n/, then split each line on /\t/.
\t is horizontal tab (moves to the next tab stop on the same line). \v is vertical tab (a different, rarely used control character).
The \t escape is core regex syntax since ES3. It works in every browser and Node.js version.
Did you know?
TSV (tab-separated values) is a common export format from spreadsheets. While CSV uses commas, TSV uses \t as the column delimiter—making split(/\t/) the natural parsing approach in JavaScript.