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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Word boundary | \b | Matches at a position that is followed by a word character but not preceded by a word character, or that is preceded by a word character but not followed by a word character. | \b. matches a, , and d in abc def | 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 | Unicode | ECMA ASCII | ECMA extended egrep awk Unicode | no | no | no | ASCII | ASCII | no | no | no |
Word boundary | \B | Matches at a position that is preceded and followed by a word character, or that is not preceded and not followed by a word character. | \B. matches b, c, e, and f in abc def | 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 | Unicode | ECMA ASCII | ECMA extended egrep awk Unicode | no | no | no | ASCII | ASCII | no | no | no |
Tcl word boundary | \y | Matches at a position that is followed by a word character but not preceded by a word character, or that is preceded by a word character but not followed by a word character. | \y. matches a, , and d in abc def | Unicode | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | Unicode | no | no | no | no | no | no | no |
Tcl word boundary | \Y | Matches at a position that is preceded and followed by a word character, or that is not preceded and not followed by a word character. | \Y. matches b, c, e, and f in abc def | Unicode | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | Unicode | no | no | no | no | no | no | no |
Tcl word boundary | \m | Matches at a position that is followed by a word character but not preceded by a word character. | \m. matches a and d in abc def | Unicode | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | Unicode | no | no | no | no | no | no | no |
Tcl word boundary | \M | Matches at a position that is preceded by a word character but not followed by a word character. | .\M matches c and f in abc def | Unicode | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | Unicode | no | no | no | no | no | no | no |
GNU word boundary | \< | Matches at a position that is followed by a word character but not preceded by a word character. | \<. matches a and d in abc def | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | ECMA extended egrep awk Unicode | no | no | no | ASCII | ASCII | no | no | no |
GNU word boundary | \> | Matches at a position that is preceded by a word character but not followed by a word character. | .\> matches c and f in abc def | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | ECMA extended egrep awk Unicode | no | no | no | ASCII | ASCII | no | no | no |
POSIX word boundary | [[:<:]] | Matches at a position that is followed by a word character but not preceded by a word character. | [[:<:]]. matches a and d in abc def | no | no | no | no | 8.34 ASCII | ASCII | 5.5.10 Unicode | XE7 ASCII | 3.0.3 ASCII | no | no | no | no | no | no | Unicode | Unicode | ASCII | ASCII | no | no | no | no | no |
POSIX word boundary | [[:>:]] | Matches at a position that is preceded by a word character but not followed by a word character. | .[[:>:]] matches c and f in abc def | no | no | no | no | 8.34 ASCII | ASCII | 5.5.10 Unicode | XE7 ASCII | 3.0.3 ASCII | no | no | no | no | no | no | Unicode | Unicode | ASCII | ASCII | no | no | no | no | no |
Word boundary behavior | Word boundaries always match at the start of the match attempt if that position is followed by a word character, regardless of the character that precedes the start of the match attempt. (Thus word boundaries are not handled correctly for the second and following match attempts in the same string.) | \b. matches all of the letters but not the space when iterating over all matches in the string abc def | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | YES | no | no | YES | YES | no | no | no | |
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/refwordboundaries.html
Page last updated: 2 December 2022
Site last updated: 06 November 2024
Copyright © 2003-2024 Jan Goyvaerts. All rights reserved.