I have two questions, first
<?php
$text = "a iKo SaioT eeee";
$fonts = "a|i|u|e|o";
$newText = preg_replace("#([$fonts].+?(?=[^$fonts![:space:]]))#us", '<b>$1</b>', $text);
echo $newText;
?>
Will be like (
a iK
o S
aioT eeee). Not (
a iK
o S
aioT
eeee). Why the last eeee letter does not change bold? And when
$text = "a" The result does not turn into bold too
Second, how to convert this code into jquery
$newText = preg_replace("#([$fonts].+?(?=[^$fonts![:space:]]))#us", '<b>$1</b>', $text);
Cause $fonts is arrays not same in php
What I have tried:
I need without space too.
Because if I put space in array a|i|u|e|o|[:space:].
It will be like this <b>e</b><b>e</b><b>e</b><b>e</b> will be separate. And if i using
#([$fonts]?(?=[^$fonts![:space:]]))#us without
.+, first and last, fonts not being bold
If i using
preg_replace('/['.$fonts.']/i', '<b>$1</b>', $text);
The result will be like this, right?
a iK
o S
aioT eeee but if you click right and inspect.
You can see <b>a</b> <b>i</b>K<b>o</b> S<b>a</b><b>i</b><b>o</b>T <b>e</b><b>e</b><b>e</b><b>e</b>
Being separated by spaces
But different from using ^$fonts![:space:]
To be <b>a</b> <b>i</b>K<b>o</b> S<b>aio</b>T eeee
Why i using exeption space? Cause Arabic script is continuous
If using ^$fonts![:space:] to be like <b>مَنْ جَاءَ بِا</b>
If not <b>م</b><b>َ</b><b>ن</b><b>ْ</b> <b>ج</b><b>َ</b><b>ا</b><b>ء</b><b>َ</b> <b>ب</b><b>ِ</b><b>ا</b>
Not same مَ نْ جَ اءَ بِ ا = مَنْ جَاءَ بِا
But this problem, like my question in post
Why the last eeee letter does not change bold? And when $text = "a" The result does not turn into bold too.