aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/dev/regex-porting.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev/regex-porting.md')
-rw-r--r--docs/dev/regex-porting.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/dev/regex-porting.md b/docs/dev/regex-porting.md
index 45033044..d0686982 100644
--- a/docs/dev/regex-porting.md
+++ b/docs/dev/regex-porting.md
@@ -27,6 +27,19 @@ for performance, replace it with the plain quantifier (`+`, `*`, `?`).
The `regex` crate never backtracks, so it has no possessive quantifiers and has no need for them.
+## `A` (anchored) modifier
+
+The PCRE `A` modifier requires the match to start exactly at the search offset. The `regex` crate
+anchors a pattern only at the head of the haystack.
+
+Port such a pattern by searching the sub-slice that begins at the offset, with a `^` in place of
+the `A` modifier:
+
+```rust
+// PHP: preg_match('/foo/A', $subject, offset: $offset)
+preg_match(php_regex!(r"/^foo/"), &subject[offset..])
+```
+
## Port other unsupported features ad hoc
For any other PCRE feature the `regex` crate does not support (conditional subpatterns,