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
  • 4,811
  • 8
  • 38
  • 62

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
  • 89,455
  • 62
  • 89
  • 125
0
\(.*?\)

Use this to remove all .

See demo.

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

vks
  • 67,027
  • 10
  • 91
  • 124