Visa ett inlägg
Oläst 2008-07-01, 09:07 #3
Innocast Innocast är inte uppkopplad
Mycket flitig postare
 
Reg.datum: Aug 2004
Inlägg: 688
Innocast Innocast är inte uppkopplad
Mycket flitig postare
 
Reg.datum: Aug 2004
Inlägg: 688
Följande kod fungerar inte... Nog att innehållet i $replacement är fel, får även felmeddelandent:

Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in ----- on line 9

Kod:
$pattern = "s!<h1>([^<]*)(\p{L}+)</h1>!<h1>\1<em>\2</em></h1>!g";

$string = '<h1>Hejsan du</h1> hahahahah <h1>wee</h1> gigigigigi <h1>apa hål</h1> dfjjsdfjk <h1>hej apa</h1>';

$replacement = '${1}1,$3';

echo preg_replace($pattern, $replacement, $string);
Innocast är inte uppkopplad   Svara med citatSvara med citat