Wrap First Character after in a tag
The major issue is just that you have a positive lookbehind but no capture group so \1 or $1 isn’t a usable variable. Fix your regex to provide the capture group: ‘/(?<=\<\/h3\>\n<p>)(.)/’ then reference as $1. ob_start();?> <h3>Heading</h3> <p>Paragraph</p> <p>Paragraph2</p> <?php $search = ob_get_clean(); $result = preg_replace( ‘/(?<=\<\/h3\>\n<p>)(.)/’, ‘<span class=”dropcap”>$1</span>’, $search );