/*** Verification email? Phone number? Password 6-15-bit? Verify the input URL? * Email address: * "[\\w]@[\\w] (. \\w+) +";*/ Public classStringDemo8 { Public Static voidMain (string[] args) {String email= "[Email protected]"; String Emailregex= "[\\w][email protected][a-za-z0-9]+ (. \\w+) +"; String Pwdregex= "[\\w]{6,15}"; String pwd= "a_34625"; String Idregex= "[2] ([\\d]{17}|[ \\d]{14}| [\\d] {16} [XX]) "; String ID= "21010219880313212X"; String jpgimg= "Mqh.jpg"; String Jpgregex= "\\."; System.out.println (Email.matches (Emailregex)); System.out.println (Pwd.matches (Pwdregex)); System.out.println (Id.matches (Idregex)); //Small application of automatic file name changestring[] NewName =Jpgimg.split (Jpgregex); Jpgimg= System.currenttimemillis () + "." +newname[1]; System.out.println (JPGIMG); //The application of the method of replacing curse swearingString fuck = "I want to say: Cnm,fuck DSB"; String Fuckregex= "fuck| SB|CNM|DSB "; Fuck= Fuck.replaceall (Fuckregex, "* * *"); System.out.println (Fuck); }}
View Code
Verify e-mail? Phone number? Password 6-15 bit? Verify input URL? ID number? File name change? Replace a string part of a word?