| 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| String anchor | ^ (caret) | Matches at the start of the string the regex pattern is applied to. | ^. matches a in abc\ndef | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | no | YES |
| String anchor | $ (dollar) | Matches at the end of the string the regex pattern is applied to. | .$ matches f in abc\ndef | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | YES | no | YES |
| String anchor | $ (dollar) | Matches before the final line break in the string (if any) in addition to matching at the very end of the string. | .$ matches f in abc\ndef\n | YES | YES | YES | YES | YES | YES | YES | YES | YES | no | no | no | YES | no | no | no | no | no | no | no | no | no | n/a | no |
| Line anchor | ^ (caret) | Matches after each line break in addition to matching at the start of the string, thus matching at the start of each line in the string. | ^. matches a and d in abc\ndef | YES | option | option | option | option | option | option | option | option | option | option | option | option | YES | YES | basic 1.38–1.63 extended 1.38–1.64 grep 1.38–1.64 egrep 1.38–1.64 awk 1.38–1.64 | option | option | option | option | option | option | n/a | option |
| Line anchor | $ (dollar) | Matches before each line break in addition to matching at the end of the string, thus matching at the end of each line in the string. | .$ matches c and f in abc\ndef | YES | option | option | option | option | option | option | option | option | option | option | option | option | YES | YES | basic 1.38–1.63 extended 1.38–1.64 grep 1.38–1.64 egrep 1.38–1.64 awk 1.38–1.64 | option | option | option | option | option | option | n/a | option |
| String anchor | \A | Matches at the start of the string the regex pattern is applied to. | \A\w matches only a in abc | YES | YES | YES | YES | YES | YES | YES | YES | YES | no | no | no | YES | YES | no | ECMA extended egrep awk | no | no | no | no | no | 10gR2 | no | no |
| Attempt anchor | \A | Matches at the start of the match attempt. | \A\w matches a, b, and c when iterating over all matches in abc def | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | YES | no | no | no | no | no | no | no |
| Attempt anchor | \G | Matches at the start of the match attempt. | \G\w matches a, b, and c when iterating over all matches in abc def | YES | no | no | no | 4.0–7.9 | no | YES | YES | YES | no | no | no | no | YES | no | no | no | no | no | no | no | no | no | no |
| Match anchor | \G | Matches at the end of the previous match during the second and following match attempts. Matches at the start of the string during the first match attempt. | \G\w matches a, b, and c when iterating over all matches in abc def | no | YES | YES | YES | 8.00 | YES | no | no | no | no | no | no | no | no | no | ECMA extended egrep awk | no | no | no | no | no | no | no | no |
| String anchor | \z | Matches at the end of the string the regex pattern is applied to. | \w\z matches f in abc\ndef but fails to match abc\ndef\n | YES | YES | YES | YES | YES | YES | YES | YES | YES | no | no | no | no | YES | no | ECMA extended egrep awk | no | no | no | no | no | 10gR2 | no | no |
| String anchor | \Z | Matches at the end of the string the regex pattern is applied to. | \w\Z matches f in abc\ndef but fails to match abc\ndef\n or abc\ndef\n\n | no | no | no | no | no | no | no | no | no | no | no | no | YES | no | no | no | YES | no | no | no | no | no | no | no |
| String anchor | \Z | Matches at the end of the string as well as before the final line break in the string (if any). | .\Z matches f in abc\ndef and in abc\ndef\n but fails to match abc\ndef\n\n | YES | YES | YES | YES | YES | YES | YES | YES | YES | no | no | no | no | YES | no | no | no | no | no | no | no | 10gR2 | no | no |
| String anchor | \Z | Matches at the end of the string as well as before all trailing line breaks in the string (if any). | .\Z matches f in abc\ndef and in abc\ndef\n and in abc\ndef\n\n | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | ECMA extended egrep awk | no | no | no | no | no | no | no | no |
| String anchor | \` (backslash backtick) | Matches at the start of the string the regex pattern is applied to. | \`\w matches only a in abc | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | ECMA extended egrep awk | no | no | no | no | no | no | no | no |
| Attempt anchor | \` (backslash backtick) | Matches at the start of the match attempt. | \`\w matches a, b, and c when iterating over all matches in abc def | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | YES | YES | no | no | no |
| String anchor | \' (backslash quote) | Matches at the end of the string the regex pattern is applied to. | \w\' matches f in abc\ndef but fails to match abc\ndef\n | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | ECMA extended egrep awk | no | 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/refanchors.html
Page last updated: 16 June 2017
Site last updated: 07 July 2017
Copyright © 2003-2017 Jan Goyvaerts. All rights reserved.