regex

Check password strength / safety with PHP and Regex

Password Validation with PHP and Regular Expressions

What is a good password? Your birthday, favorite star or first school, car, ...? None of them, because all similar passwords are very easy to crack.

My golden rule for safe-passwords is simple: Google or any search engine should NOT find any result for your password-string. But do not search for your password without changing some characters, because it will be visible as clear-text to all networks between your pc and Google server.

Mysql replace with regexp

Mysql uses regex and returns true/false, also just if matching but can not capture/catch. Is there a way to use mysql-regex to replace matching records without php?

E-Mail validation with Java and regular expressions (regex)

With a few lines of code you can check if an E-Mail address ist valid or not. The most import part ist our pattern:

String pattern = "([a-z0-9_.-]+@[a-z0-9-]+\\.[a-z]{2,6})";

import java.util.regex.*;

public class EmailCheck {

	public static void main(String[] args) {

		String eMail = "youremailyoursite.com"; 
		
		String pattern = "([a-z0-9_.-]+@[a-z0-9-]+\\.[a-z]{2,6})";
		if(eMail.matches(pattern)){
			System.out.println("Your E-Mail address is valid");
		}else{
			System.out.println("You entered a not valid E-Mail address");
		}

	}

}

Regex (regular expression) password check with Java

Our String is
aaaaaZZaa44

and with the regular
((?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{6,})

we check if our password contains at least one digit, one upper and lower case.
we also check the length of the password, if its greater than 6.

import java.util.regex.*;
public class RegexPwdCheck {


	public static void main(String[] args) {

		String passwd = "aaaaaZZaa44"; 
		String pattern = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{6,})";
		System.out.println(passwd.matches(pattern));

	}
}
Syndicate content

CafeWebmaster.com(CW) is a free online community for webdevelopers and beginners. Anybody can share their code, articles, tips, tutorials, code-examples or other webdesign related material on the site. Newbies can submit their questions and reply to existing questions. CW does not guarantee or warrant reliability of code, data and information published on the site. Use the site on your own risk. The site takes no responsibility of direct or indirect loss or any kind of harm to its users. The site also doesn't take responsibility of infected files or source code with any kind of infection or viruses, worms, spywares, malwares, trojan horses. CW reserves the right to edit, move, or delete any of content for any reason.