Skip to content

Instantly share code, notes, and snippets.

@treffynnon
Created July 9, 2010 17:31
Show Gist options
  • Save treffynnon/469749 to your computer and use it in GitHub Desktop.
Save treffynnon/469749 to your computer and use it in GitHub Desktop.
Regex for adding a drop cap span into article text
<?php
$article['full_text'] = preg_replace('/^([\<\sa-z\d\/\>]*)(([a-z\&\;]+)|([\"\'\w]))/', '$1<span class="drop-cap">$2</span>', $article['full_text']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment