Skip to content

Instantly share code, notes, and snippets.

@sorki
Created July 25, 2011 12:52
Show Gist options
  • Save sorki/1104054 to your computer and use it in GitHub Desktop.
Save sorki/1104054 to your computer and use it in GitHub Desktop.
<?php
$txt = 'abcd ***animation(text1|text2) defg ***animation(txt1|txt2)';
function replace_anim($matches) {
return '[[Replaced: 1-"'.$matches[1].'"-2-"'.$matches[2].'"]]';
}
$ret = preg_replace_callback('~\*\*\*animation\(([^|]+)\|([^|]+)\)~', "replace_anim", $txt);
echo $ret;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment