I found this solution: here but its in javascript, I try to do it with PHP and I got a warning.
Here is my code:
$dynamicstring = 'שָׁמַיִם';
$newstring2 = preg_replace('[\u0591-\u05C7]', '', $dynamicstring);
The warning I have got:
Warning: preg_replace(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 1 in
What is it mean? so if it not support what can I use?
Edit: I was able to do this by the following code:
preg_replace('/[^\w$\x-\x]+/u', '', $dynamicstring);
But this code remove spaces between words in the string, how to fix that?
Second Edit: the solution is to do this:
preg_replace('/[^\w$\x-s-\x]+/u', '', $dynamicstring);
I added -s-
between the \x
s