Preg_Replace $pattern syntax error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

How can I convert the regular expression: <p\s+style="padding-left: \s+(\d+)px;">(.*?)</p>
into a pattern that PHP will accept?

I am getting the error:
Warning: preg_replace() [function.preg-replace]: Unknown modifier '(' in /Library/WebServer/Documents/tamagotchi/runtime/content/js/tiny_mce/ examples/tinymce_regex.php on line 24

I am very new to regular expressions and any help is appreciated. Something to do with escaping certain strings?
G


$html =<<<EOB
TinyMCE is a <span style="font-style: italic;">platform</span>
<p style="text-align: center;">We recommend <a href="http://www.getfirefox.com " target="_blank">Firefox</a> </p>
<p style="padding-left: 30px;">May the Regular Expression Find Me!</p>
EOB;

$pattern='<p\s+style="padding-left:\s+(\d+)px;">(.*?)</p>';
$replace= '<textformat indent=\\1>\\2</textformat>';
echo preg_replace($pattern,$replace, $html );



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux