preg_match
preg_match — Perform a regular expression match.Description
preg_match( string $pattern,Searches subject for a match to the regular expression given in pattern.
string $subject,
array &$matches = null,
int $flags = 0,
int $offset = 0 ): int|false
Parameters
pattern
The pattern to search for, as a string.
subject
The input string.
matches
If matches is provided, then it is filled with the results of search. $matches[0] will contain the text that matched the full pattern, $matches[1] will have the text that matched the first captured parenthesized subpattern, and so on.
flags
flags can be a combination of the following flags: PREG_OFFSET_CAPTURE, PREG_UNMATCHED_AS_NULL
offset
Normally, the search starts from the beginning of the subject string. The optional parameter offset can be used to specify the alternate place from which to start the search (in bytes).
Return Values
preg_match() returns 1 if the pattern matches given subject, 0 if it does not, or false if an error occurred.More information about preg_match on official PHP documentation site
preg_match - Popular snippets
- PHP 8.0 / MySQL 5.7 preg_match
last run:
2022-10-05 10:16:04
47
- PHP 8.0 / MySQL 5.7 preg_match preg_replace
last run:
2021-01-12 14:29:49
21
- PHP 8.1 / MySQL 5.7 preg_match print_r
last run:
2023-10-03 08:18:02
20
- PHP 8.0 / MySQL 5.7 preg_match print_r
last run:
2021-08-23 20:56:54
18
- PHP 8.1 / MySQL 5.7 base64_decode preg_match_all count str_replace chr hexdec preg_match
last run:
2023-11-12 20:14:19
17
- PHP 8.0 / MySQL 5.7 implode array_filter preg_match array_map strlen range
last run:
2021-05-02 20:42:52
16
- PHP 8.0 / MySQL 5.7 preg_match
last run:
2021-11-23 10:15:21
15
- PHP 8.1 / MySQL 5.7 preg_match
last run:
2024-07-23 08:04:56
13
- PHP 8.1 / MySQL 5.7 preg_match var_dump
last run:
2023-10-03 07:00:04
13
- PHP 7.4 / MySQL 5.7 preg_match str_replace date_default_timezone_set strtotime date round abs
last run:
2023-03-26 14:06:36
13
preg_match - New snippets
-
PHP 8.1 / MySQL 5.7 preg_match basename
added at:
2024-10-04 13:36:13
1
-
PHP 8.1 / MySQL 5.7 preg_match
added at:
2024-10-04 13:36:01
1
-
PHP 8.1 / MySQL 5.7 preg_match basename
added at:
2024-10-04 13:33:30
2
-
PHP 8.1 / MySQL 5.7 preg_match print_r
added at:
2024-09-14 16:02:19
1
-
PHP 8.1 / MySQL 5.7 preg_match print_r
added at:
2024-09-14 16:01:29
2
-
PHP 8.1 / MySQL 5.7 preg_match print_r
added at:
2024-09-14 16:01:10
6
-
PHP 8.1 / MySQL 5.7 preg_match print_r
added at:
2024-09-14 16:00:51
2
-
PHP 8.1 / MySQL 5.7 preg_match print_r
added at:
2024-09-14 15:58:19
2
-
PHP 8.1 / MySQL 5.7 preg_match print_r
added at:
2024-09-14 15:58:10
2
-
PHP 8.1 / MySQL 5.7 preg_match print_r
added at:
2024-09-14 15:57:54
3