PHP error, preg_replace?

Posted on 2008-11-16
Last Modified: 2013-12-13
I get this error message when posting certain message in my site, its a contacts board, and the content of the text is not being stored in the database, so this is a crytical error :( how can i solve this?

I also sen attached the code in config.php

Warning: preg_replace() [function.preg-replace]: Compilation failed: POSIX named classes are supported only within a class at offset 21 in /mounted-storage/home43a/sub004/sc31952-BMDX/www/contacts/config.php on line 725

function FilterMessage($message){


//eregi_replace( "^([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([a-z]{2,6})$", '\\1 at \\2 dot \\3',$message);

$message = preg_replace("#(\w|\.)+?@(\w|\.)+?\.[:a-z:]{2,4}?#is","##",$message); //eliminate email addresses(this is line 725)

$message = strip_tags($message);

$message = nl2br($message); //keep carriage returns

return $message;


Open in new window

Question by:axtur
    LVL 19

    Accepted Solution

    From what  I understand... the posix error is coming from this [:a-z:]{2,4} ... can you change that to [a-z]{2,4} ???

    Author Comment


    thank you for your answer, but how can this error show up now, since this code has been working for over a year so far?

    I can't understand :(

    anyway im gonna apply the suggested change and let you know if it works out.

    thanks again!

    Author Comment

    It worked, probably somme inner software update in the server??

    thank you!
    LVL 19

    Expert Comment

    I'm guessing it was an update that caused the code to stop working... perhaps a POSIX extension was installed and/or enabled... not sure... i'm glad that it's working now.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    As this topic comes over and over again in different forms, I've finally decided to write a short (yea, right...) article / tutorial about pagination with PHP with MySQL database. There are dozens of these kind of tutorials, I know - I wanted to mak…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now