PHPcode $ zz2 = & quot;/\ & lt; (a | )(.*?) (Href | Href) = ('| \ & quot; |\\\\\ & quot; |) (. + ?) & Gt; & lt; (img | IMG )(.*?) (Src | SRC) = ('| \ & quot; | \\\\\ & a piece of PHP regular expressions
PHP code
$ Zz2 = "/\ <(a | )(.*?) (Href | Href) = ('| \ "| \\\\" |) (. +?)> <(Img | IMG )(.*?) (Src | SRC) = ('| \ "| \\\\ \" |) (. + ?) (.Jpg |. JPG |. gif |. GIF |. png |. PNG |. bmp |. BMP |. jpeg |. JPEG) (. *?)> <\/(A | A)>/is "; $ text = preg_replace ($ zz2, "<\ 6 \ 7 \ 8 = \ 9 \ 10 \ 11 \ 12>", $ text );
Read the PHP code for "remove image links,
The following are some puzzles about the code:
1. the \ <'\ at the beginning is a character escape, <This character is not a metacharacter. why do we use \ to escape it?
2. is it specified to be case insensitive later? is it necessary to use a combination to distinguish (A | a) the case?
------ Solution --------------------
This regular expression is too lengthy, and your understanding is correct.
------ Solution --------------------
1: can be added or not added.
2: no need. Write one.