Re: Problem with Regular expression

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

 



Try with \s instead of \b, I meant:

$pattern = "/(\sand\s)|(\snot\s)|(\sor\s)|(\s&&\s)|(\s&\s)|(\s\.\s)|(\s\+\s)|(\s\|\|\s)|(\s\|\s)/i";

kioto wrote:

Hi all.
I have a problem: i want subs any characters from a string but i don't have fix the problem.
The string that i want to manipulate is the value from a text field of a search engine.
The characters that i want to try substitute is &&, &, +, -, |, ||, or, and, not in not case-sensitive mode with "".
I have create a pattern like this:


$str = "Sybase and PHP not ASP or JSP && Oracle not Andy | Perl || Python + Ruby";
$pattern = "/(\band\b)|(\bnot\b)|(\bor\b)|(\b&&\b)|(\b&\b)|(\b\.\b)|(\b\+\b)|(\b\|\|\b)|(\b\|\b)/i";


echo $str = preg_replace($pattern, "", $str, -1);

But characters like + && don't subs with "".
Thanks to all and sorry my bad language


-- 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