note 129704 added to function.preg-match
| From: | turabgarip@gmail.com | Date: | Tue, 13 Aug 2024 13:07:16 +0000 |
| Subject: | note 129704 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221477@lists.php.net to get a copy of this message | ||
Worth to note that you might experience different results in regex functions when your string
includes literal tab characters or the tab character notation.
As you know, tab character matches with \s since it's a whitespace. But what if we use a
numeric quantifier? Like \s{2,}
This should match two or more subsequent whitespace characters, including two tabs (or one tab and
one space), but not one tab only. But you might experience at some places your literal tab character
matching with this quantifier. This is because some editors silently convert tab characters to 2 or
4 spaces according to your auto-indentation settings. This makes it eligible for \s{2,} since
it's not a tab character anymore. But if you have the tab character notation (\t) instead of
the literal tab string, this will never happen and thus it won't match this regex.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 46.1.2.249)
----
Manual Page -- https://php.net/manual/en/function.preg-match.php
Edit -- https://main.php.net/note/edit/129704
Del: integrated -- https://main.php.net/note/delete/129704/integrated
Del: useless -- https://main.php.net/note/delete/129704/useless
Del: bad code -- https://main.php.net/note/delete/129704/bad+code
Del: spam -- https://main.php.net/note/delete/129704/spam
Del: non-english -- https://main.php.net/note/delete/129704/non-english
Del: in docs -- https://main.php.net/note/delete/129704/in+docs
Del: other reasons-- https://main.php.net/note/delete/129704
Reject -- https://main.php.net/note/reject/129704
Search -- https://main.php.net/manage/user-notes.php