Android 汉字的正则表达式

2014-11-24 12:11:38 · 作者: · 浏览: 2

   "^d+$"  //非负整数(正整数 + 0)
  "^[0-9]*[1-9][0-9]*$"  //正整数
  "^((-d+)(0+))$"  //非正整数(负整数 + 0)
  "^-[0-9]*[1-9][0-9]*$"  //负整数
  "^- d+$"  //整数
  "^d+(.d+) $"  //非负浮点数(正浮点数 + 0)
  "^(([0-9]+.[0-9]*[1-9][0-9]*)([0-9]*[1-9][0-9]*.[0-9]+)([0-9]*[1-9][0-9]*))$"  //正浮点数
  "^((-d+(.d+) )(0+(.0+) ))$"  //非正浮点数(负浮点数 + 0)
  "^(-(([0-9]+.[0-9]*[1-9][0-9]*)([0-9]*[1-9][0-9]*.[0-9]+)([0-9]*[1-9][0-9]*)))$"  //负浮点数
  "^(- d+)(.d+) $"  //浮点数
  "^[A-Za-z]+$"  //由26个英文字母组成的字符串
  "^[A-Z]+$"  //由26个英文字母的大写组成的字符串
  "^[a-z]+$"  //由26个英文字母的小写组成的字符串
  "^[A-Za-z0-9]+$"  //由数字和26个英文字母组成的字符串
  "^w+$"  //由数字、26个英文字母或者下划线组成的字符串
  "^[w-]+(.[w-]+)*@[w-]+(.[w-]+)+$"  //email地址
  "^[a-zA-z]+://(w+(-w+)*)(.(w+(-w+)*))*( S*) $"  //url



如何判断输入的字符串是否是汉字,用正则表达式:^[\u4e00-\u9fa5]*$


Pattern pa = Pattern.compile( "^[\u4e00-\u9fa5]*$ ");
Matcher matcher = pa.macther( "我是中国人 ");
matcher.find(); //true为全部是汉字,否则是false