Title: Deprecated: Function eregi_replace() is deprecated
Last modified: August 30, 2016

---

# Deprecated: Function eregi_replace() is deprecated

 *  Resolved [Geoffrey](https://wordpress.org/support/users/creativejuiz/)
 * (@creativejuiz)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/deprecated-function-eregi_replace-is-deprecated-1/)
 * Hi there,
 * It’s me, again 🙂
 * I continued my little dev and found that:
 *     ```
       Deprecated: Function eregi_replace() is deprecated in /Applications/MAMP/htdocs/gereso/wp-content/plugins/dofollow-case-by-case/dofollow-case-by-case.php on line 259
       ```
   
 * To fix this, just replace line 259 by that line :
 *     ```
       $text = preg_replace('#(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~\#?&//=]+)#i','$1', $text);
       ```
   
 * Just after that, I do a var_dump() of $url in this clearComment() function and
   found lots of NULL.
 * I found two NULL by comment, so that function is called two times by comment.
 * Lines 586 and 587, you use two filters. Why? One seems to be enough.
    `comment_text`
   is an alias of `get_comment_text`, so by keeping only the `get_comment_text`,
   the work is done 🙂
 * Finally, if comment contains something between double-quotes, your regexp will
   return the content between those double-quotes instead of NULL.
 * Oh, other point : by using preg_match, your function can be improved:
 *     ```
       function clearComment( $comment ) {
       	preg_match( '%(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@|\d{1,3}(?:\.\d{1,3}){3}|(?:(?:[a-z\d\x{00a1}-\x{ffff}]+-?)*[a-z\d\x{00a1}-\x{ffff}]+)(?:\.(?:[a-z\d\x{00a1}-\x{ffff}]+-?)*[a-z\d\x{00a1}-\x{ffff}]+)*(?:\.[a-z\x{00a1}-\x{ffff}]{2,6}))(?::\d+)?(?:[^\s]*)?%iu', $comment, $matches );
       	return isset( $matches[0] ) ? trim( $matches[0], '"') : NULL;
       }
       ```
   
 * Regexp inspired by [https://gist.github.com/dperini/729294](https://gist.github.com/dperini/729294)
 * Thank you.
 * [https://wordpress.org/plugins/dofollow-case-by-case/](https://wordpress.org/plugins/dofollow-case-by-case/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [apasionados](https://wordpress.org/support/users/apasionados/)
 * (@apasionados)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/deprecated-function-eregi_replace-is-deprecated-1/#post-6902376)
 * Hi Geoffrey,
 * Thank you very much for your great work. We have updated the plugin and are testing
   it since yesterday on some of our sites. If there are no problems we will upload
   it later today.
 * Thank you very much.
 * Ramón.

Viewing 1 replies (of 1 total)

The topic ‘Deprecated: Function eregi_replace() is deprecated’ is closed to new 
replies.

 * ![](https://ps.w.org/dofollow-case-by-case/assets/icon-128x128.png?rev=982876)
 * [DoFollow Case by Case](https://wordpress.org/plugins/dofollow-case-by-case/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/dofollow-case-by-case/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/dofollow-case-by-case/)
 * [Active Topics](https://wordpress.org/support/plugin/dofollow-case-by-case/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/dofollow-case-by-case/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/dofollow-case-by-case/reviews/)

## Tags

 * [deprecated](https://wordpress.org/support/topic-tag/deprecated/)
 * [preg_match](https://wordpress.org/support/topic-tag/preg_match/)
 * [preg_replace](https://wordpress.org/support/topic-tag/preg_replace/)

 * 1 reply
 * 2 participants
 * Last reply from: [apasionados](https://wordpress.org/support/users/apasionados/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/deprecated-function-eregi_replace-is-deprecated-1/#post-6902376)
 * Status: resolved