Can I use Character Encoding for Regular Expressions?
Can I use 开发者_StackOverflowCharacter Encoding for Regular Expressions...?
e.g.
this.html().replace(/<\/?[^>]+>/gi, '')
Instead of:
this.html().replace(/<\/?[^>]+>/gi, '')
Define "use" ..
Inside a regex literal, <
will never translated or considered the same as <
. That doesn't mean you can't use it in your expression, it just means you'll be matching <
rather than <
var x = "<html>";
x.match('<[^>]+>'); // => <html>
x.match('<[^>]+>'); // => null
精彩评论