| Replacement Reference |
| Characters |
| Matched Text & Backreferences |
| Case Conversion |
| Context |
| Conditionals |
| Feature | Syntax | Description | Example | JGsoft | Python | JavaScript | VBScript | XRegExp | .NET | Java | ICU | RE2 | Perl | PCRE | PCRE2 | PHP | Delphi | R | Ruby | std::regex | Boost | Tcl | POSIX | GNU | Oracle | XML | XPath |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Shorthand | Any shorthand outside character classes | Shorthands can be used outside character classes. | \w matches a single word character | YES | YES | YES | YES | YES | YES | YES | YES | default | YES | YES | YES | YES | YES | YES | YES | ECMA | ECMA extended egrep awk | YES | n/a | YES | YES | YES | YES |
| Shorthand | Any shorthand inside a character class | Shorthands can be used inside character classes. | [\w] matches a single word character | YES | YES | YES | YES | YES | YES | YES | YES | default | YES | YES | YES | YES | YES | YES | YES | ECMA | YES | YES | n/a | no | no | YES | YES |
| Shorthand | Any negated shorthand inside a character class | Negated shorthands can be used inside character classes. | [\W] matches a single character that is not a word character | YES | YES | YES | YES | YES | YES | YES | YES | default | YES | YES | YES | YES | YES | YES | YES | ECMA | YES | error | n/a | no | no | YES | YES |
| Shorthand | \d | Adds all digits to the character class. Matches a single digit if used outside character classes. | [\d] and/or \d match a character that is a digit | Unicode | 3.0 Unicode 2.4 ASCII | ASCII | ASCII | ASCII | non‑ECMA Unicode | ASCII | Unicode | default ASCII | Unicode | ASCII | ASCII | Unicode | ASCII | ASCII | ASCII | ECMA Unicode | Unicode | Unicode | no | no | Unicode | Unicode | Unicode |
| Shorthand | \w | Adds all word characters to the character class. Matches a single word character if used outside character classes. | [\w] and/or \w match any single word character | Unicode | 3.0 Unicode 2.4 ASCII | ASCII | ASCII | ASCII | non‑ECMA Unicode | ASCII | Unicode | default ASCII | Unicode | ASCII | ASCII | Unicode | ASCII | ASCII | ASCII | ECMA Unicode | Unicode | Unicode | no | ASCII | Unicode | Unicode | Unicode |
| Shorthand | \s | Adds all whitespace to the character class. Matches a single whitespace character if used outside character classes. | [\s] and/or \s match any single whitespace character | Unicode | 3.0 Unicode 2.4 code page | Unicode | ASCII | Unicode | non‑ECMA Unicode | 7 code page 4 ASCII | Unicode | default ASCII | Unicode | 8.10 code page 4.5 ASCII | code page | Unicode | ASCII | ASCII | 2.0 code page 1.8 ASCII | ECMA Unicode | Unicode | Unicode | no | ASCII | Unicode | ASCII | ASCII |
| Shorthand | \l and \u | Adds all lowercase letters or all uppercase letters to the character class. Matches a single lowercase or uppercase letter if used outside character classes. | \u\l matches Aa but not aA. | V2 Unicode | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | Unicode | no | no | no | no | no | no |
| Shorthand | \v | Adds all vertical whitespace to the character class. Matches a single vertical whitespace character if used outside character classes. | [\v] and/or \v match any single vertical whitespace character | V2 Unicode | no | no | no | no | no | 8 Unicode | Unicode | no | Unicode | 7.2 Unicode | Unicode | Unicode | Unicode | Unicode | no | no | ECMA 1.42 Unicode | no | no | no | no | no | no |
| Shorthand | \h | Adds all horizontal whitespace to the character class. Matches a single horizontal whitespace character if used outside character classes. | [\h] and/or \h match any single horizontal whitespace character | V2 Unicode | no | no | no | no | no | 8 Unicode | Unicode | no | Unicode | 7.2 Unicode | Unicode | Unicode | Unicode | Unicode | no | no | 1.42 Unicode | no | no | no | no | no | no |
| Shorthand | \h | Adds all hexadecimal digits to the character class. Matches a hexadecimal digit if used outside character classes. | [\h] and/or \h match any single hexadecimal digit | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | 1.9 ASCII | no | no | no | no | no | no | no | no |
| XML Shorthand | \i | Adds all characters that are allowed as the initial character in XML names to the character class. Matches one such character if used outside character classes. | \i\c* matches an XML name | V2 | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | YES | YES |
| XML Shorthand | \c | Adds all characters that are allowed as the second and following characters in XML names to the character class. Matches one such character if used outside character classes. | \i\c* matches an XML name | V2 | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | YES | YES |
| Feature | Syntax | Description | Example | JGsoft | Python | JavaScript | VBScript | XRegExp | .NET | Java | ICU | RE2 | Perl | PCRE | PCRE2 | PHP | Delphi | R | Ruby | std::regex | Boost | Tcl | POSIX | GNU | Oracle | XML | XPath |
| Quick Start | Tutorial | Search & Replace | Tools & Languages | Examples | Reference |
| Introduction | Table of Contents | Quick Reference | Characters | Basic Features | Character Classes | Shorthands | Anchors | Word Boundaries | Quantifiers | Capturing Groups & Backreferences | Named Groups & Backreferences | Special Groups | Unicode Characters and Properties | Unicode Versions | Unicode Categories | Unicode Scripts | Unicode Blocks | Unicode Binary Properties | Unicode Property Sets | Unicode Boundaries | Mode Modifiers | Recursion & Balancing Groups | Backtracking Control Verbs |
| Characters | Matched Text & Backreferences | Case Conversion | Context | Conditionals |
Page URL: https://www.regular-expressions.info/refshorthand.html
Page last updated: 22 May 2025
Site last updated: 29 October 2025
Copyright © 2003-2025 Jan Goyvaerts. All rights reserved.