Skip to content

Instantly share code, notes, and snippets.

@kstirn
Created January 3, 2015 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kstirn/e0564f92e39034cd0529 to your computer and use it in GitHub Desktop.
Save kstirn/e0564f92e39034cd0529 to your computer and use it in GitHub Desktop.
Working example
<?php
$text = 'susulsususulsusulsusususulsususulsususulsususulsusulsususulsususulsususulsususul';
$text = preg_replace('#(^|[\n\t (>])(([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%\'\*\+\-\/\=\?\^\`{\|\}\~]|&amp;)+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,63})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?))#i', '' , $text);
echo $text;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment