JavaScript RegExp \v Metacharacter

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Vertical tab

What You’ll Learn

The \v metacharacter matches a vertical tab (VT, U+000B)—a legacy control character that advances to the next vertical tab stop. It is rarely seen in modern text, but knowing it helps when cleaning old files or understanding the full \s whitespace class.

01

VT char

\v

02

U+000B

VT control

03

vs \t

Horizontal tab

04

In \s

Whitespace

05

Remove

replace(/\v/g)

06

Legacy

Rare today

Introduction

JavaScript regular expressions include escapes for several control characters. You already know \t (horizontal tab) and \n (newline). The \v metacharacter targets the vertical tab—a separate character with its own Unicode code point.

Vertical tabs are uncommon in web content, JSON, and everyday strings. They appear more often in legacy printer formats, old terminal data, or accidentally corrupted text. When you need to detect or strip them, /\v/ gives you precise control instead of matching every whitespace type with \s.

Understanding the \v Metacharacter

\v matches the vertical tab character (Unicode U+000B, ASCII 11). In JavaScript string literals, "\v" creates the same character that /\v/ matches in a regex.

JavaScript
const text = "line1\vline2";

/\v/.test(text);           // true
/\v/.test("hello world");  // false

"\v" === "\u000B";         // true (same code point)

Vertical tab is included in \s but is not the same as horizontal tab (\t) or newline (\n). Each escape matches exactly one specific control character.

💡
Beginner Tip

If you only need “any whitespace,” use \s. Reach for \v when you specifically want to find or remove vertical tab characters without touching spaces or newlines.

How to Use \v in JavaScript

Use \v in detection, cleaning, splitting, and validation workflows:

JavaScript
/\v/.test("a\vb");                 // true
"one\vtwo".split(/\v/);           // ["one", "two"]
"hello\vworld".replace(/\v/g, ""); // "helloworld"
/\s/.test("x\vy");                 // true (\v is whitespace)

Pair \v with the global flag for bulk removal, or combine with other control-character escapes when sanitizing imported legacy data.

📝 Syntax

JavaScript
\v              // one vertical tab
\v+             // one or more vertical tabs
/\v/g           // global: every vertical tab
split(/\v/)      // split on vertical tab
\s              // any whitespace (includes \v)

Common patterns

  • /\v/ — detect whether a vertical tab exists.
  • /\v/g with replace("", ...) — remove all vertical tabs.
  • /[\t\n\v\r\f]/ — match common control whitespace explicitly.
  • /\u000B/ — same character using the Unicode escape form.

⚡ Quick Reference

GoalPattern
One vertical tab\v
Remove all vertical tabs/\v/g
Split on vertical tabsplit(/\v/)
Any whitespace\s
Horizontal tab\t
Code pointU+000B (VT)

📋 \v vs \t vs \n vs \s

Four related patterns for tab and whitespace handling.

Vertical tab
\v

U+000B VT

Horizontal tab
\t

U+0009 HT

Newline
\n

U+000A LF

Whitespace
\s

All of the above + more

Examples Gallery

Open DevTools Console (F12) or use Try-it links. Examples cover detection, comparison with other control chars, removal, the \s class, and splitting on a vertical tab delimiter.

📚 Getting Started

Detect whether a string contains a vertical tab character.

Example 1 — Test for a Vertical Tab Character

Return true when a vertical tab appears in the text.

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

How It Works

A single \v matches one vertical tab character. Strings with only spaces or horizontal tabs do not satisfy the pattern because those are different code points.

📈 Practical Patterns

Compare, clean, and parse text containing vertical tabs.

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

Count each control character type in a mixed string.

JavaScript
const sample = "a\vb\tc\nd";

console.log(sample.match(/\v/g).length); // 1
console.log(sample.match(/\t/g).length); // 1
console.log(sample.match(/\n/g).length); // 1
Try It Yourself

How It Works

Each escape matches a distinct character. This helps when you need to normalize one type without affecting others—for example, removing \v but keeping \t delimiters.

Example 3 — Remove Vertical Tab Characters

Strip vertical tabs from legacy or corrupted text.

JavaScript
const dirty = "hello\vworld\v!";

const clean = dirty.replace(/\v/g, "");
console.log(clean);              // "helloworld!"
console.log(dirty.length);       // 13 (includes 2 VT chars)
console.log(clean.length);       // 11
Try It Yourself

How It Works

The global flag with /\v/g removes every vertical tab. Use a space as the replacement if you want to preserve separation between words.

Example 4 — Vertical Tab Is Matched by \s

Confirm that the general whitespace class includes vertical tab.

JavaScript
const text = "x\vy";

console.log(/\s/.test(text));  // true
console.log(text.split(/\s/)); // ["x", "y"]
console.log(/\v/.test(text));  // true
Try It Yourself

How It Works

JavaScript’s \s includes vertical tab along with space, tab, newline, carriage return, and form feed. Use \v when you need VT specifically, not all whitespace.

Example 5 — Split on a Vertical Tab Delimiter

Break a string at vertical tab boundaries (rare but valid delimiter).

JavaScript
const row = "one\vtwo\vthree";

const parts = row.split(/\v/);
console.log(parts);        // ["one", "two", "three"]
console.log(parts.join(" + ")); // "one + two + three"
Try It Yourself

How It Works

split(/\v/) works like split(/\t/) for TSV, but vertical tab delimiters are extremely uncommon in modern data formats.

🚀 Common Use Cases

  • Legacy file cleanup — strip vertical tabs from old terminal or printer exports.
  • Data sanitization — remove invisible control characters before validation.
  • Whitespace auditing — detect which control chars appear in pasted content.
  • Logging — flag unexpected VT characters in log pipelines.
  • Understanding \s — know every character the whitespace class can match.
  • Normalization — convert vertical tabs to spaces or newlines for display.

Important Considerations

  • Very rare — most modern text never contains \v; do not assume it is present.
  • Not horizontal tab\v is vertical tab; use \t for column separators.
  • Part of \s/\s+/ also matches vertical tabs, but mixes all whitespace types.
  • Global flag — omitting g in replace() removes only the first vertical tab.
  • Same as \u000B/\v/ and /\u000B/ match the identical character.

🧠 How \v Matches Vertical Tabs

1

Read character

The engine inspects the next character at the current position.

Scan
2

Check U+000B

\v succeeds only if the character is a vertical tab (VT).

Match
3

Apply quantifier

With + or global replace, the engine repeats the VT check.

Extend
4

Continue pattern

VT matched → advance. Other char → fail or backtrack.

📝 Notes

  • \v is vertical tab (U+000B, ASCII 11).
  • Vertical tab is included in the \s whitespace class.
  • Review \t for horizontal tab and \n for newlines.
  • Previous metacharacter: \uXXXX Unicode escape.
  • Next metacharacter: \w word character.
  • Equivalent Unicode form: \u000B matches the same character as \v.

Browser & Runtime Support

The \v vertical tab metacharacter is part of core JavaScript regular expression syntax.

Baseline · ES3+

RegExp \v

Supported in every browser and Node.js version. \v matches the vertical tab control character (U+000B).

99% Universal syntax
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 everywhere. Use \v when you need to target vertical tabs specifically, beyond general \s whitespace.

Conclusion

The \v metacharacter matches the vertical tab character (U+000B). It is a legacy control character rarely seen in modern text, but it belongs to the full set of whitespace characters that \s can match.

Use /\v/g to remove vertical tabs from old files, compare with \t and \n when auditing control characters, and remember that \v is not interchangeable with horizontal tab. Next, learn the \w word-character metacharacter.

💡 Best Practices

✅ Do

  • Use \v when cleaning legacy control characters
  • Use /\v/g to remove all vertical tabs at once
  • Compare \v, \t, and \n when debugging whitespace
  • Use \s when any whitespace separator is acceptable
  • Know that \u000B is equivalent to \v

❌ Don’t

  • Confuse \v (vertical) with \t (horizontal tab)
  • Expect vertical tabs in typical web or JSON content
  • Forget the global flag when replacing all vertical tabs
  • Assume \n and \v behave the same way
  • Strip \v when you actually need \t delimiters

Key Takeaways

Knowledge Unlocked

Five things to remember about RegExp \v

Match the vertical tab control character for legacy text cleanup.

5
Core concepts
📈 02

U+000B

VT code.

Unicode
🚫 03

\t

Horizontal.

Compare
🔒 04

/\v/g

Remove.

Clean
🔢 05

\s

Includes VT.

Related

❓ Frequently Asked Questions

\v matches the vertical tab character (VT, Unicode U+000B, ASCII 11). It is a legacy control character that moves to the next vertical tab stop on the same column.
No. \t is horizontal tab (U+0009), \n is line feed/newline (U+000A), and \v is vertical tab (U+000B). Each is a distinct single character with its own code point.
Yes. In JavaScript, the \s whitespace class includes vertical tab along with space, horizontal tab, newline, carriage return, and form feed.
Very rare. Most everyday text uses spaces, horizontal tabs, and newlines. You may encounter \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 if you prefer to preserve word separation.
The \v escape is core regex syntax since ES3. It works in every browser and Node.js version without extra flags.
Did you know?

Vertical tab was designed for old line printers to advance paper vertically without starting a new line. Modern software almost always uses \n for line breaks and \t for indentation instead—which is why \v is included in \s but rarely appears in real-world strings.

Continue to \w word-character metacharacter

Learn how \w matches letters, digits, and underscores in JavaScript regex.

\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