Home >php教程 >php手册 >有关于PHP正则表达式汇总

有关于PHP正则表达式汇总

WBOY
WBOYOriginal
2016-06-06 19:55:521275browse

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 18 //只能输入数字 19 function test_shuzi(strshuzi){ 20 var myReg =/^[0-9]*$/; 21 if(myReg.test(strshuzi)) return true; 22 return false; 23 } 24 //只能输入汉字 25 function test_han

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

 

  18

  //只能输入数字

  19

  function test_shuzi(strshuzi){

  20

  var myReg =/^[0-9]*$/;

  21

  if(myReg.test(strshuzi)) return true;

  22

  return false;

  23

  }

  24

  //只能输入汉字

  25

  function test_hanzi(strhanzi){

  26

  var myReg =/^[\u4e00-\u9fa5]{0,}$/;

  27

  if(myReg.test(strhanzi)) return true;

  28

  return false;

  29

  }

  30

  

  31

  

  32

  

  33

  

姓名:

  34

  

  35

  

  36

  

  37

  

  38

  

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn