Javascript RegExp教程

JavaScript RegExp \uxxxx

说明

\uxxxx 匹配十六进制数 xxxx 指定的 Unicode 字符;例如,\u0009 与 \t 相同。

示例

以下示例显示了 RegExp 表达式的用法。
<html>
   <head>
      <title>JavaScript RegExp</title>
   </head>
   
   <body>
      <script type = "text/javascript">
		 var str = "ab\u0009c";
         var pattern = /\u0009/g;
         var index = str.search(pattern);
         document.write("Test 1-returned value : " +  index); 
         str = "abc";
         index = str.search(pattern);
         document.write("<br/>Test 2-returned value : " +  index); 	 		 
      </script>
   </body>
</html>

输出

Test 1-returned value : 2
Test 2-returned value :-1
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4