JavaScript RegExp – \xnn 描述 \xnn匹配十六进制数nn指定的拉丁字符;例如,\x0A与\n相同。 示例 以下示例显示了RegExp表达式的使用方法。 <html> <head> <title>JavaScript RegExp</title> </head> <body> <script type = "text/javascript"> var str = "ab\x0Ac"; var pattern = /\x0A/g; var index = str.search(pattern); document.write("测试1 - 返回值 : " + index); str = "abc"; index = str.search(pattern); document.write("<br/>测试2 - 返回值 : " + index); </script> </body> </html> HTMLCopy 输出 测试1 - 返回值 : 2 测试2 - 返回值 : -1HTMLCopy