17種正則表達式
發(fā)表時間:2023-08-17 來源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]"^\\d+$" //非負(fù)整數(shù)(正整數(shù) + 0) "^[0-9]*[1-9][0-9]*$" //正整數(shù) "^((-\\d+) (0+))$&q...
"^\\d+$" //非負(fù)整數(shù)(正整數(shù) + 0)
"^[0-9]*[1-9][0-9]*$" //正整數(shù)
"^((-\\d+) (0+))$" //非正整數(shù)(負(fù)整數(shù) + 0)
"^-[0-9]*[1-9][0-9]*$" //負(fù)整數(shù)
"^-?\\d+$" //整數(shù)
"^\\d+(\\.\\d+)?$" //非負(fù)浮點數(shù)(正浮點數(shù) + 0)
"^(([0-9]+\\.[0-9]*[1-9][0-9]*) ([0-9]*[1-9][0-9]*\\.[0-9]+) ([0-9]*[1-9][0-9]*))$" //正浮點數(shù)
"^((-\\d+(\\.\\d+)?) (0+(\\.0+)?))$" //非正浮點數(shù)(負(fù)浮點數(shù) + 0)
"^(-(([0-9]+\\.[0-9]*[1-9][0-9]*) ([0-9]*[1-9][0-9]*\\.[0-9]+) ([0-9]*[1-9][0-9]*)))$" //負(fù)浮點數(shù)
"^(-?\\d+)(\\.\\d+)?$" //浮點數(shù)
"^[A-Za-z]+$" //由26個英文字母組成的字符串
"^[A-Z]+$" //由26個英文字母的大寫組成的字符串
"^[a-z]+$" //由26個英文字母的小寫組成的字符串
"^[A-Za-z0-9]+$" //由數(shù)字和26個英文字母組成的字符串
"^\\w+$" //由數(shù)字、26個英文字母或者下劃線組成的字符串
"^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$" //email地址
"^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$" //url