PHP RegEx
Regular Expressions.
PHP Regular Expressions
A regular expression is a sequence of characters that forms a search pattern. When you search for data in a text, you can use this search pattern to describe what you are searching for.
Regular expressions can be used to perform all types of text search and text replace operations.
Common RegEx Functions
preg_match()- Returns 1 if the pattern was found in the string and 0 if notpreg_match_all()- Returns the number of times the pattern was found in the stringpreg_replace()- Returns a new string where matched patterns have been replaced with another string
RegEx Modifiers
i- Performs a case-insensitive searchm- Performs a multiline searchu- Enables correct matching of UTF-8 encoded patterns