| Quick Start | Tutorial | Tools & Languages | Examples | Reference | Book Reviews |
| 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 | Unicode | Unicode | ASCII | ASCII | 5.3.4 Unicode 5.0.0 code page | ASCII | code page | 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 | Unicode | Unicode | ASCII | ASCII | 5.3.4 Unicode 5.0.0 code page | ASCII | code page | 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 code page | 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 code page | 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 |
Did this website just save you a trip to the bookstore? Please make a donation to support this site, and you'll get a lifetime of advertisement-free access to this site!
| 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: http://regular-expressions.mobi/refwordboundaries.html
Page last updated: 25 November 2016
Site last updated: 07 July 2017
Copyright © 2003-2017 Jan Goyvaerts. All rights reserved.