Skip to content

Instantly share code, notes, and snippets.

@mulatinho
Created February 12, 2015 02:28
Show Gist options
  • Save mulatinho/532f5f4d71a90ae6211f to your computer and use it in GitHub Desktop.
Save mulatinho/532f5f4d71a90ae6211f to your computer and use it in GitHub Desktop.
hmm.. some regexp that i wrote late night
$buffer = preg_replace('/(http([^\s]+))/', '<a target="_blank" href="\\1">\\1</a>', $buffer);
$buffer = preg_replace('/(image:)([^\s]+)/',
'<img style="float: right; margin: 0px 0px 15px 15px; width: 150px;" src="\\2"/>', $buffer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment