Regular Expression - Backslash Generic Character Class (shorthand)



The use of backslash are called shorthand) and specifies:


The syntax of a shorthand in a regular pattern.



  • the first character is a backslash
  • the second is a letter

Most well known

Generic character types Description Equivalent to
\d any decimal digit [0-9]
\D any character that is not a decimal digit [^0-9]
\h any horizontal whitespace character
\H any character that is not a horizontal whitespace character
\s any whitespace character [\f\n\r\t\v​\u00a0\u1680​\u180e\u2000​-\u200a​\u2028\u2029\u202f\u205f​\u3000\ufeff]
\S any character that is not a whitespace character [^ \f\n\r\t\v​\u00a0\u1680​\u180e\u2000​-\u200a​\u2028\u2029\u202f\u205f​\u3000\ufeff]
\v any vertical whitespace character
\V any character that is not a vertical whitespace character
\w any “word” character [A-Za-z0-9_]
\W any “non-word” character [^A-Za-z0-9_]

These character type sequences can appear both inside and outside character classes. They each match one character of the appropriate type. If the current matching point is at the end of the subject string, all of them fail, since there is no character to match.

Discover More
Notepad Eol
A step by step on how to replace a text in Notepad++ with regular expression

A step by step tutorial and snippets on how to replace a portion of text in notepad++ with regular expression
Data System Architecture
Character - Tabulation

Tabulation are non-visible, control characters that permits to align text. The most known is the 0009Horizontal tabulation (ie HT, character 9) or \t as shorthand that is part of the space character...
Data System Architecture
Character - Whitespace

White-space characters is a set of characters that contains: spaces, tabs, and line breaks They are part of the non printing characters. They may be a difference between the class: ...
Regexp - Backslash

Backslash is the general escape meta-character with several uses. It can: Stand for itself, Quote the next character, Introduce an operator, Do nothing see The third use of backslash...
Regexp - Character Class (Character Set)

A character class defines a domain of permitted characters. character set ASCII characters with square brackets where: [ is the start character class definition ] is the end character class...
Regexp - Word Characters

A word can be represented by the shorthand class (\w) and is specified as: any letter (ie the class [A-Za-z]) or any digit (ie the class [0-9]) or the underscore character (ie the [_]) It would...
Regular Expression - Line (Beginning and End)

Page the definition of line boundary (EOL) in regular expression You can define the begining or the end of a line with boundary matcher boundary matcher Description ^ The beginning of a line...
Bash Liste Des Attaques Ovh
Sh - String Variable

String Variable, see also character string in bash. When calling a function, quote the variable otherwise bash will not see the string as atomic but as an array Sh with Bash “” The...

Share this page:
Follow us:
Task Runner