: This article describes common regular expressions for php hyperlinks. For more information about PHP tutorials, see. 1. delete the hyperlink in the content
Ereg_replace ('] *)> ([^ <] *)', '\ 2', $ content );
Ereg_replace ("] * >|<\/ a>", "", $ content );
2. remove hyperlinks containing specific words
$ Find = "this string is my find ";
$ String = 'replaced'; // The content of the hyperlink.
Echo ereg_replace ('] *)> ([^ <] *'. $ find. '[^>] *)', '\ 2', $ content );
3. obtain hyperlink 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 );
The above describes common regular expressions for php hyperlinks, including some content. I hope you can help others who are interested in PHP tutorials.