preg_match php get string code example
Example 1: php preg match space or start of string
/\b(stackoverflow)\b/
Example 2: php preg_match
preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] ) : int
Example 3: 12 hrs for preg match with single and double digit in php
((1[0-2]|0?[1-9]):([0-5][0-9]) ?([AaPp][Mm]))
12:00 pm --------- OK
13:00
1:00 am --------- OK
5:5 am
5:05 PM --------- OK
55:55
09:59 // valid time, but meridiem is missing
:01
0:59
00:59 PM