Here is an example:
$str = '<p>"bla" bla</p>';
$search = '_^<p> *([\w])(.+) *</p>$_i';
$replacement = '<p><span class="first_letter">$1</span>$2</p>';
$new = preg_replace( $search, $replacement, $str );
echo $new."\n";
It works perfectly. But if the given string starts with some kind of special char such as ", ‘, it will remove it.
example $str = '<p>bla bla</p>';
To sum up I want to put the first letter in this <span> (given above).
Not tested, but try adding
\W(capital W) which matches non-word characters instead of matching zero or more spaces in the search string. That should then match your first letter.EDIT: to include special character
put it in brackets to capture it
or as completed code…