JavaScript RegExp \t meta-character
- Previous Page \r
- Next Page \v
- Go to the Previous Level JavaScript RegExp Reference Manual
Definition and usage
\t
Match horizontal tab characters (tab).
Example
Search for tab characters in a string:
let text = "Visit CodeW3C.com.\tLearn Javascript."; let pattern = /\t/;
Syntax
new RegExp("\\t")
Or abbreviated as:
/\t/
Browser support
/\t/
It is an ECMAScript1 (ES1) feature.
All browsers fully support ES1 (JavaScript 1997):
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Supports | Supports | Supports | Supports | Supports | Supports |
Regular expression search methods
In JavaScript, regular expression text search can be completed using different methods.
UsagePattern (pattern)As regular expressions, these are the most commonly used methods:
example | description |
---|---|
text.match(pattern) | 字符串方法 match() |
text.search(pattern) | 字符串方法 search() |
pattern.exec(text) | RexExp 方法 exec() |
pattern.test(text) | RexExp Method test() |
- Previous Page \r
- Next Page \v
- Go to the Previous Level JavaScript RegExp Reference Manual