Replacement Reference |
Characters |
Matched Text & Backreferences |
Context & Case Conversion |
Conditionals |
Feature | Syntax | Description | Example | JGsoft | .NET | Java | Perl | PCRE | PCRE2 | PHP | Delphi | R | JavaScript | VBScript | XRegExp | Python | Ruby | std::regex | Boost | Tcl ARE | POSIX BRE | POSIX ERE | GNU BRE | GNU ERE | 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 | YES | YES | YES | YES | YES | YES | ECMA | ECMA extended egrep awk | YES | n/a | n/a | YES | YES | 10gR2 | 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 | YES | YES | YES | YES | YES | YES | ECMA | YES | YES | n/a | n/a | no | 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 | YES | YES | YES | YES | YES | YES | ECMA | YES | error | n/a | n/a | no | 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 | non‑ECMA Unicode | ASCII | Unicode | ASCII | ASCII | 5.3.4 Unicode 5.0.0 ASCII | ASCII | ASCII | ASCII | ASCII | ASCII | 3.0 Unicode 2.4 ASCII | ASCII | ECMA Unicode | Unicode | Unicode | no | no | no | no | 10gR2 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 | non‑ECMA Unicode | ASCII | Unicode | ASCII | ASCII | 5.3.4 Unicode 5.0.0 code page | ASCII | ASCII | ASCII | ASCII | ASCII | 3.0 Unicode 2.4 ASCII | ASCII | ECMA Unicode | Unicode | Unicode | no | no | ASCII | ASCII | 10gR2 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 | non‑ECMA Unicode | ASCII | Unicode | ASCII | ASCII | 5.3.4 Unicode 5.0.0 code page | ASCII | ASCII | Unicode | ASCII | Unicode | 3.0 Unicode 2.4 ASCII | ASCII | ECMA Unicode | Unicode | Unicode | no | no | ASCII | ASCII | 10gR2 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 | Unicode | no | no | 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 | 8 Unicode | 5.10 Unicode | 7.2 Unicode | Unicode | 5.2.4 Unicode | Unicode | Unicode | no | no | no | no | no | no | ECMA 1.42–1.85 Unicode | no | no | 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 | 8 Unicode | 5.10 Unicode | 7.2 Unicode | Unicode | 5.2.4 Unicode | Unicode | Unicode | no | no | no | no | no | no | 1.42–1.85 Unicode | no | no | 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 | 1.9 ASCII | no | no | 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 | .NET | Java | Perl | PCRE | PCRE2 | PHP | Delphi | R | JavaScript | VBScript | XRegExp | Python | Ruby | std::regex | Boost | Tcl ARE | POSIX BRE | POSIX ERE | GNU BRE | GNU ERE | Oracle | XML | XPath |
| Quick Start | Tutorial | Tools & Languages | Examples | Reference | Book Reviews |
| Introduction | Table of Contents | Quick Reference | Characters | Basic Features | Character Classes | Shorthands | Anchors | Word Boundaries | Quantifiers | Unicode | Capturing Groups & Backreferences | Named Groups & Backreferences | Special Groups | Mode Modifiers | Recursion & Balancing Groups |
| Characters | Matched Text & Backreferences | Context & Case Conversion | Conditionals |
Page URL: https://www.regular-expressions.info/refshorthand.html
Page last updated: 16 August 2024
Site last updated: 06 November 2024
Copyright © 2003-2024 Jan Goyvaerts. All rights reserved.