---
title: "实用的正则表达式"
author: "txf2004"
date: "2008-12-30T09:50:00Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2009-09-19T07:52:48Z"
id: 471293
url: "https://txf2004.iteye.com/blog/471293"
---

大于0 的数字  
(\[1-9]\[0-9]\*(\\.\\d+)?)|(0\\.\\d+)  
"^\\d+$"　　//非负整数......

"^\\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