Actually I’m trying to come up with a way of getting a string like “GEWO” out of the “Get Word” by using preg_replace function. The thing is there also can be a strings like “Get”, or “Get Word And another Word” so I have to get the proper string respectively.
Thanks!
Advertisement
Answer
Use this:
JavaScript
x
$s = "Get Word And another Word";
$s = preg_replace('/(?<=w{2})w*b(s|$)/','',$s);
$s = strtoupper($s);
echo $s;
ouput: GEWOANANWO