PHP filter, replace Hyperlink # filter out hyperlink ereg_replace (& lt; a [^ & gt;] * & gt; | & lt; a & gt;, $ content ); # clear the hyperlink $ findthisstringismyfind; $ string & lt; fontcolorred & gt; the content will be replaced with & lt; fo PHP filter, replacing the hyperlink
# Filter out the hyperlink ereg_replace ("] *> | <\/a>", "", $ content ); # clear the hyperlink $ find = "this string is my find"; $ string = 'content to be replaced '; // echo ereg_replace ('] *)> ([^ <] *'. $ find. '[^>] *)', '\ 2', $ content); # The following describes how to obtain hyperlinks in html text content: // method 1 preg_match_all ('/<(a | a) [s] {0, 1} [w = ":()] *> [nrn] * (check user) [nrn] *
/I ', $ string, $ matches); // method 2 preg_match_all ('/check user/I ', $ string, $ matches); print_r ($ matches ); // method 3 preg_match_all ('/] *> [^ <] */I', $ string, $ matches); print_r ($ matches ); // method 4 preg_match_all ('/check user/is', $ str, $ arr); print_r ($ arr ); // method 5 preg_match_all ('/check user/is', $ str, $ arr); print_r ($ arr );
?