Search code examples
phpregexpreg-replacenon-latin

PHP, regex issue with non Latin characters


In a string I'm trying to remove everything inside parentheses with preg_replace but I have some issue with non Latin characters. I tried:

$text = '(Hàng Refurbished) sdfsdfsdfsd (Đen)';
$text = preg_replace('#\([A-Z0-9p{L}]+\)#i', '', $text);
$text = preg_replace('# $#','', $text);
echo $text;

but it's not working

Any suggestion please?


Solution

  • \(.*?\)
    

    Use this to remove all .

    See demo.

    http://regex101.com/r/rX0dM7/5