Answer the question
In order to leave comments, you need to log in
How to find in the text and highlight a certain letter at the beginning of words (php, regex)?
For example me". Big or small - it doesn't matter, but they should remain the same.
Apple pit wash -> I blocko I ma wash
Answer the question
In order to leave comments, you need to log in
$re = '/(\w+?)(?:[^\w]|$)/siu';
$str = preg_replace_callback($re, function($m) {
return "<span class='red'>". mb_substr($m[1], 0, 1) ."</span>". mb_substr($m[1], 1);
}, $str );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question