0

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?

woshitom
  • 3,357
  • 7
  • 27
  • 44

2 Answers2

1

Use the u modifier, add space in the character class and the unicode property is \p{L}:

$text = preg_replace('#\([A-Z0-9\p{L} ]+\)#ui', '', $text);
//                            __^  __^   __^
Toto
  • 83,193
  • 59
  • 77
  • 109
0
\(.*?\)

Use this to remove all .

See demo.

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

vks
  • 63,206
  • 9
  • 78
  • 110