Of course!!
Running this in a Firebug console
"®ü".replace(/[®ü]/g,"replaced")
came back
"replacedreplaced"
You can also do
"®ü".replace(/[\xAE\xFC]/g,"Wohoo! ");
which returns
"Wohoo! Wohoo! "
A good hexadecimal search page can be found at http://www.ascii.cl/htmlcodes.htm
Example
running jQuery on this page
$(".post-text").text().replace(/®/g," ******** ")
returns
" is it possible to translate special characters like ******** , ü etc with javascript
String replace function? Use this syntax... string.replace(/\xCC/g/,''); Where 'CC' is
the hex character code for the char you are wanting to replace. In this example I am
replacing with empty string ''. yes, and is as simple as can be: ' ******** '.replace('
******** ','anything'); Sure is! Running this in the Firebug console " ******** ü".
replace(/[ ******** ü]/g,"replaced") returned replacedreplaced "
source
share