开发者

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, &lt; 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 &lt; rather than <

var x = "<html>";

x.match('<[^>]+>'); // => <html>
x.match('&lt;[^>]+>'); // => null
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜