From 3fdb2807b31a78a40ad89570e30ec77466c98717 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 16 Nov 2022 19:32:04 +0100 Subject: [PATCH] Update docs --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e125cf0..4a7896b 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,8 @@ if (Preg::matchStrictGroups('{fo+}', $string, $matches)) if (Preg::matchAllStrictGroups('{fo+}', $string, $matches)) ``` -**Note:** This is generally safe to use as long as you do not have optional subpatterns (i.e. `(something)?` or `(something)*`). +**Note:** This is generally safe to use as long as you do not have optional subpatterns (i.e. `(something)?` +or `(something)*` or branches with a `|` that result in some groups not being matched at all). A subpattern that can match an empty string like `(.*)` is **not** optional, it will be present as an empty string in the matches. A non-matching subpattern, even if optional like `(?:foo)?` will anyway not be present in matches so it is also not a problem to use these with `*StrictGroups` methods.