开发者

Can I use Character Encoding for Regular Expressions?

开发者 https://www.devze.com 2023-01-02 08:22 出处:网络
Can I use 开发者_StackOverflowCharacter Encoding for Regular Expressions...? e.g. this.html().replace(/<\\/?[^>]+>/gi, \'\')

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

精彩评论

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