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.1 / MySQL 5.7 preg_match array_filter var_dump
last run:
2024-11-05 10:05:49
15
- 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
preg_match - New snippets
-
PHP 8.1 / MySQL 5.7 preg_match
added at:
2024-11-12 06:31:28
3
-
PHP 8.1 / MySQL 5.7 preg_match
added at:
2024-11-12 06:31:16
1
-
PHP 8.1 / MySQL 5.7 preg_match
added at:
2024-11-12 06:30:45
1
-
PHP 8.0 / MySQL 5.7 preg_match print_r
added at:
2024-11-05 19:16:14
3
-
PHP 8.0 / MySQL 5.7 preg_match print_r
added at:
2024-11-05 19:15:26
3
-
PHP 8.0 / MySQL 5.7 preg_match print_r preg_match print_r
added at:
2024-11-05 19:15:20
1
-
PHP 8.1 / MySQL 5.7 preg_match array_filter var_dump
added at:
2024-11-05 10:06:53
2
-
PHP 8.2.13 / MySQL 5.7 preg_match array_filter var_dump
added at:
2024-11-05 10:06:48
1
-
PHP 7.4 / MySQL 5.7 preg_match array_filter var_dump
added at:
2024-11-05 10:06:41
1