hur gör jag för att plocka ut hejsan!
function test($text) {
$text = preg_replace ("'<b>(*.?)</b>'i", "$1", $text );
return $text;
}
echo test("gg<b>hejsan</b>kkkkk");
2 svar · 250 visningar · startad av pellesvenne
hur gör jag för att plocka ut hejsan!
function test($text) {
$text = preg_replace ("'<b>(*.?)</b>'i", "$1", $text );
return $text;
}
echo test("gg<b>hejsan</b>kkkkk");
först och främst (.*?) ska det vara _inte_ (*.?)
sedan måste du escapepa $1 så här \$1 .
Funktionen bör altså vara så här:
###########
function test($text) {
$text = preg_replace ("'<b>(.*?)</b>'i", "\$1", $text );
return $text;
}
function test($text) {
preg_match("'<b>(.*?)</b>'is",$text,$text);
$text = $text[1];
return $text;
}
echo test("gg<b>hejsan</b>kkkkk");