Page 1 of 1

Warning: Unknown modifier ']' in /usr...

Posted: Sat Aug 11, 2007 9:18 am
by ykarmi
Hey Guys,
Quick question, I'm trying to run the following script on my website

Code: Select all

$content = '<br>hello</br>';
$content = preg_replace('<[^>]+>','<br>',$content);
echo $content;
But I get Warning: Unknown modifier ']' in /usr...
What's going on?
Here's a php info page:
http://www.ykcreations.com/tibiaWars/phpinfo.php
Thanks,
Yuval :D

Posted: Sat Aug 11, 2007 9:39 am
by superdezign
phpinfo() tells us nothing in this case.

What line of code is the warning referring to?

Re: Warning: Unknown modifier ']' in /usr...

Posted: Sat Aug 11, 2007 10:22 am
by Benjamin

Code: Select all

$content = preg_replace('#<[^>]+>#','<br>',$content);

Thank you!

Posted: Sat Aug 11, 2007 10:43 pm
by ykarmi
Thank you very much. That completely solved the problem. Does PHP not accept regex inside single quotes?
Thanks!
Yuval

Re: Thank you!

Posted: Sun Aug 12, 2007 8:22 am
by superdezign
ykarmi wrote:Thank you very much. That completely solved the problem. Does PHP not accept regex inside single quotes?
Thanks!
Yuval
No, astions pointed out that you forgot your delimiters.