I tried your code in Chrome javascript console but mine shows correctly
str = "Arc's 漢字"
$a = str.replace(/[^a-z\d\s]+/gi,'')
console.log($a) // "Arcs "
The 039s looks like it's displaying the unicode number. You don't mention where or how you are printing it.
If your looking for a regex solution in PHP, I use something like this for Japanese:
$str = "Arc's 漢字"
$new = preg_replace("/(\p{Z}|\p{P}|\p{Han}|\p{Katakana}|\p{Hiragana})+/u", '', $str )
// $this->assertEquals("Arc's", $new );
This says to replaces all
- space characters (\p{Z}),
- punctuation (\p{P}),
- Chinese characters (\p{Han}),
- Japanese hiragana (\p{Hiragana})
- Japanese katakana (\p{Katakana}) ... using unicode (/u) .. with nothing ('')
Laravel has a string->slug function that strips all punctuation and non alphanumeric characters, and lower cases the string suitable for urls
$str = "Arc's 漢字";
// $this->assertEquals('arcs', str_slug($str ));