JavaScript RegExp Vertical Tab Metacharacter (\v)

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

What Is \v?

\v matches one vertical tab character (VT, U+000B). It is a rare legacy control character—useful when cleaning old data, not for everyday text formatting.

Remember
\v  → vertical tab (U+000B)
\t  → horizontal tab (U+0009)
\n  → newline / line feed (U+000A)

/\v/.test("hello")   → false
/\v/.test("a\vb")    → true
"a\vb".replace(/\v/g, "|") → "a|b"
UsePrefer
Detect VT/\v/
Remove VTstr.replace(/\v/g, "")
Any whitespace\s (includes \v)
Horizontal tab\t

How to Use \v

Treat vertical tab as a precise control character—not as a newline or horizontal tab.

  1. Insert VT in demos with "\v" or "\u000B".
  2. Use /\v/ with test, split, or replace.
  3. Add the g flag when every vertical tab must be removed.
  4. Prefer \v over \s when other whitespace should stay.
PieceRequired?Role
\v in the patternYesMatch one vertical tab
String escapeFor demos"\v" inserts VT into a string
g flagOptionalFind or replace every VT
vs \t / \n—Different code points — do not mix them up

Pseudocode

Pseudocode
pattern has "\v"
read next character ch from the string

if ch.codePoint === 11:   // vertical tab (U+000B)
    accept match
else:
    fail this path

common actions:
  test(str)              → true if any VT exists
  replace(/\v/g, "")     → strip every VT
  split(/\v/)            → parts between VT delimiters

Cheat Sheet

Keep these facts handy when cleaning control characters.

TopicDetail
CharacterVertical tab — U+000B (code point 11)
Detect/\v/.test(str)
Removestr.replace(/\v/g, "")
Whitespace?Yes — included in \s
Not the same as\t (HT) · \n (LF) · \f (FF)
Also written\u000B · \x0B
StandardES3+ (universal)

Live Preview

Run common \v operations on sample strings that contain a vertical tab.

Browser demo of the RegExp \v vertical tab escape — same ideas as the examples below.

Result
text = "hello"
/\v/.test(text)
→ false

/* no vertical tab present */

JavaScript Examples

Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.

Example 1 — Detect a Vertical Tab

Return true only when a real VT character is present.

JavaScript
console.log(/\v/.test("hello")); // false
console.log(/\v/.test("a\vb"));  // true
console.log(/\v/.test("a\tb"));  // false
Try It Yourself

How It Works

  1. Plain text. "hello" has no VT → false.
  2. Insert VT. "\v" embeds a real U+000B character.
  3. Pattern matches. /\v/ finds that character anywhere in the string.
  4. Horizontal tab differs. "\t" is U+0009 — not matched by \v.

Example 2 — Compare \v, \t, and \n

Confirm that vertical tab, horizontal tab, and newline are distinct.

JavaScript
const withVT = "a\vb";

console.log(/\v/.test(withVT)); // true
console.log(/\t/.test(withVT)); // false
console.log(/\n/.test(withVT)); // false
console.log(/\s/.test(withVT)); // true
Try It Yourself

How It Works

  1. Only VT is present. The sample uses "\v", not tab or newline.
  2. \v hits. Vertical tab matches → true.
  3. \t and \n miss. Different control characters → false.
  4. \s still hits. Vertical tab counts as whitespace.

Example 3 — Remove Vertical Tabs

Strip invisible VT characters from legacy or messy input.

JavaScript
const dirty = "left\vright\v";

console.log(dirty.replace(/\v/g, ""));  // "leftright"
console.log(dirty.replace(/\v/g, " ")); // "left right "
console.log(dirty.charCodeAt(4));      // 11
Try It Yourself

How It Works

  1. Two VT bytes. They sit between and after the words.
  2. Delete them. Replace with "" joins the text.
  3. Or keep a gap. Replace with a space if you want word separation.
  4. Confirm with code. charCodeAt returns 11 for VT.

Edge Cases & Pitfalls

Check these before relying on \v in real projects.

rare

Vertical tab is uncommon today

Most modern text never includes VT. Reach for \v when cleaning legacy data—not for everyday formatting.

mixup

\v ≠ \t ≠ \n

Three different control characters. Use the escape that matches the code point you actually have.

scope

\s is broader than \v

\s also matches space, tab, and newline. Use \v when those must stay untouched.

visible

VT is hard to see

When debugging, print charCodeAt, JSON.stringify, or replace VT with a marker like "|".

Browser & Runtime Support

The \v vertical tab escape is core regex syntax (ES3+) and works everywhere JavaScript runs.

✓ Baseline · ES3+

RegExp \v

Supported in every modern and legacy browser, plus all Node.js versions. No polyfill required.

100% Universal support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
\v Excellent

Bottom line: Safe to use in any JavaScript environment. Prefer \v over \s when you need vertical-tab-only matching.

Performance Notes

ApproachCostBest for
/\v/.test(str)O(n)Quick “has VT?” checks
str.replace(/\v/g, "")O(n)Sanitizing legacy text
str.split(/\v/)O(n)Rare VT-delimited data

Single-character escapes are cheap. Prefer \s only when you intentionally want every whitespace type.

Key Takeaways

  • Role: \v matches one vertical tab (U+000B).
  • Distinct: not the same as \t or \n.
  • Whitespace: VT is included in \s.
  • Cleanup: replace(/\v/g, "") removes legacy VT noise.

One line: \v finds the vertical tab — detect it, do not confuse it with \t/\n, and strip it when cleaning legacy text.

Frequently Asked Questions

\v matches the vertical tab character (VT, Unicode U+000B, ASCII 11). It is a legacy control character that advances to the next vertical tab stop.
No. \t is horizontal tab (U+0009), \n is line feed (U+000A), and \v is vertical tab (U+000B). Each is a distinct single character.
Yes. In JavaScript, the \s whitespace class includes vertical tab along with space, horizontal tab, newline, carriage return, and form feed.
Very rare. Everyday text uses spaces, horizontal tabs, and newlines. You may see \v in legacy files, printer control data, or corrupted pasted content.
Use replace with the global flag: text.replace(/\v/g, "") to delete them, or replace with a space to keep word separation.
The \v escape is core regex syntax since ES3. It works in every browser and Node.js version.

Next: \w word character

Learn how the word metacharacter matches letters, digits, and underscore.

\w tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful