我注意到 Bell 有一个正则表达式字符。我却无法匹配。我读到了这个角色的内容维基百科 http://en.wikipedia.org/wiki/Bell_character,但我不明白如何在正则表达式中找到它。
<input type="text" value="␇" />
<input type="text" value="\a" />
http://jsfiddle.net/umQq8/ http://jsfiddle.net/umQq8/
/␇/
匹配␇
, /\\a/
匹配\a
http://jsfiddle.net/umQq8/1/ http://jsfiddle.net/umQq8/1/
维基百科文章是关于铃铛角色的,但这个角色是U+2407 SYMBOL FOR BELL http://www.fileformat.info/info/unicode/char/2407/index.htm, not 铃铛字符 http://www.fileformat.info/info/unicode/char/07/index.htm
In your JSFiddle, you are writing \a
in HTML, but in HTML the backslash escapes are not interpreted in any special way. In Javascript, backslash is a meta-character but the sequence \a
is unrecognized and it will be treated as literal backslash and a. If you want actual bel character in your form, you need to write actual bel character (kinda hard because it's invisible) or 
you can't because those are illegal.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)