QuestionsPHP remove all brackets from string
mmWebetutorial Staff asked 2 weeks ago

If you have lots of words with brackets and you want to remove those brackets then use the below preg_replace expression:

$result = preg_replace(‘/\(([^()]*+|(?R))*\)\s*/’, ”, $artical);

OR

echo preg_replace(“/\([^)]+\)/”,””,$artical);

This will remove such like brackets:

$artical = “WWF World Heavyweight Champion/WWF Champion (with his last reign being as Undisputed WWF/WWE Champion) and a six-time WCW World Heavyweight Champion. He was the first wrestler to win consecutive Royal Rumbles, in 1990 and 1991 respectively”;

 

Your Answer
Login
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.