PHP string Regular replacement function Preg_replace Use instructions, the need for friends can refer to the next.
1. Preg_replace ()
$msg = Preg_replace ("/<style>.+<\/style>/is", "", $msg); -----Delete <style></style> and the middle part $msg = Preg_replace ("/<[^>]+>/", "", $msg); -----is to delete <> and intermediate content
I (pcre_caseless)
If this modifier is set, the characters in the pattern will match the uppercase and lowercase letters.
S (pcre_dotall)
If this modifier is set, the dot character (.) in the pattern matches all characters, including the line break. Without this setting, the line break is not included. This is equivalent to Perl's/s modifier. Exclude character classes such as [^a] always match line breaks, regardless of whether this modifier is set.
2. Ereg () and eregi ()
Note: the Preg_match () function is usually a faster alternative than ereg ()
Eregi ("<body ([^>]+) > (. +) </body>", $data, $b)----see if there is a body tag in $data. If so, assign the parameter $b[0], and the middle part assigns a value of $b[1].
BOOL Ereg (string pattern, string string [, array regs]) int eregi (string pattern, string string, array [regs])
Eregi () and Ereg () are similar in usage. The difference is that ereg () is case-sensitive, and eregi () is not case-insensitive.