Home > php教程 > php手册 > body text

有关于PHP正则表达式汇总

WBOY
Release: 2016-06-06 19:55:52
Original
1224 people have browsed it

欢迎进入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

  

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!