views:

35

answers:

2

How can I search for a » character in a JavaScript regexp?

Code that's not working right now:

var extralinks = new RegExp('»','g');  
div.innerHTML = div.innerHTML.replace(extralinks,'This is special punctuation');  

Grazie!

A: 

look up the ASCII table and escape the character http://www.asciitable.com/

westoque
I guess the question is - how do I escape it? I've looked up the representation for the right double angle quotes. Options: Hex BB, HTML number » HTML name ». But how to tell Javascript that this is a hex representation of a character and not just the characters BB?
Summer
+4  A: 

var extraLinks = /\xBB/g;

whiner