From 1f902e17c9d9e98657370cedece476cfaf7dde25 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 23 Feb 2022 12:08:43 +0100 Subject: [PATCH] Fix doc for String --- components/string.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/string.rst b/components/string.rst index 85f020eb6ed..caff1413382 100644 --- a/components/string.rst +++ b/components/string.rst @@ -334,12 +334,11 @@ Methods to Search and Replace u('foo')->equalsTo('foo'); // true // checks if the string content match the given regular expression. - // You can pass flags for preg_match() as second argument. If PREG_PATTERN_ORDER - // or PREG_SET_ORDER are passed, preg_match_all() will be used. u('avatar-73647.png')->match('/avatar-(\d+)\.png/'); - // result = ['avatar-73647.png', '73647'] - u('avatar-73647.png')->match('/avatar-(\d+)(-\d+)?\.png/', \PREG_UNMATCHED_AS_NULL); // result = ['avatar-73647.png', '73647', null] + + // You can pass flags for preg_match() as second argument. If PREG_PATTERN_ORDER + // or PREG_SET_ORDER are passed, preg_match_all() will be used. u('206-555-0100 and 800-555-1212')->match('/\d{3}-\d{3}-\d{4}/', \PREG_PATTERN_ORDER); // result = [['206-555-0100', '800-555-1212']]