I have some strings they are combinations of numbers and letters both like:
A555D1E , 452AE, now i want to set a different color for numbers and letters.
So I need to surround numbers in string with html tags like span or b and result should be like this:
html:
<div class="spec-text">A<span class="n">555</span>D<span class="n">1</span>E</div>
css:
spec-text{
color:red;
}
spec-text .n{
color:green;
}
if there is some function like:
function surroundNumbersByTag($string, $tag, $classes){
// codes that return this string:
// 'A<span class="n">555</span>D<span class="n">1</span>E'
}
is there anyway ?