Q:

Regular expression that match letters from all language php

im trying for few hours to find the right regular expression in php to match any language letters but to prevent it to allow space
i have try this 
[^\p{L}]

this is ok but it look like it allow the space
then i have try this
[^\w_-]

and it still look that it allow space 
anyone can help with this please ?

A:

You need to specify the Unicode modifier u to get Unicode character properties in PCRE.
For example...
$pattern = "/([\p{L}]+)/u";
$string  = "你好，世界！Привет мир! !مرحبا بالعالم";
if (preg_match_all($pattern, $string, $match)) {
    var_dump($match);
}

Gives us...
array(2) {
  [0]=>
  array(6) {
    [0]=>
    string(6) "你好"
    [1]=>
    string(6) "世界"
    [2]=>
    string(12) "Привет"
    [3]=>
    string(6) "мир"
    [4]=>
    string(10) "مرحبا"
    [5]=>
    string(14) "بالعالم"
  }
  [1]=>
  array(6) {
    [0]=>
    string(6) "你好"
    [1]=>
    string(6) "世界"
    [2]=>
    string(12) "Привет"
    [3]=>
    string(6) "мир"
    [4]=>
    string(10) "مرحبا"
    [5]=>
    string(14) "بالعالم"
  }
}

