PHP How to Check String Content With preg_match() Regex Function

October 21, 2011 | By Duchateaux.

If you need to Check the Syntax of a String in PHP you dispose of the preg_match() function. This function use a Regular Expression Pattern to Verify the String Content, if the Pattern is Matched it Return True else it Return False.
If you want to Know What form of Regex pre_match() use the answer is contained in his pre Suffix, because pre is an Abbreviation of Perl Regular Expression.
A general form of pre_match() utilization is like:

pre_match('/pcrePattern/', $string)

For an Documentation pre/pcre Syntax look: Here


QuickChic Theme • Powered by WordPress