Posts marked with "RegEx" in categories

How To Create A Simple Password Strength Checker In jQuery

A lot of new hacking methods are coming day by day. So it’s the programmers duty to make their user’s password secure. Here is a simple Password Strength Checker created using jQuery. The code contain a function got from WordPress (I modified it) which is the core component of the checker. This checker will check the following on the password :

  1. Have minimum value of 4 characters.
  2. Whether the username matches with password
  3. Whether the password contain small a-z characters and capital A-Z characters.
  4. Whether the password has numeric characters and special characters.

If all of the above criteria is matched, the checker will give a Strong Password message.

... [READ MORE]

Create Your Own URL Shortening Service Using PHP & jQuery

I made a URL shortening service a year back using PHP & jQuery. It was pretty simple. You should know the concept of URL Shortening. The concept is simple. When a user sends a request to short a URL, PHP will check if the URL is valid. If it’s valid then PHP will make a string of 5 or 6 characters. A folder is created with the name of this string and an index.php file with header function code is created in this folder. This will make the folder redirect to the URL the user requested. Since it’s a folder no extensions will be seen ! So You can make up some pretty good URL‘s.

... [READ MORE]

Using Regex to validate E-mail and Phone Number

Here is the RegEx expression to validate Phone number and E-mail.

RegEx expression for validating E-mail :

/^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/

and the RegEx expression for validating Phone number :

/^(?([0-9]{3}))?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/

Here is an example of usage of these RegEx expressions in JavaScript.

var emailregex=/^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;var phoneregex=/^(?([0-9]{3}))?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;if (emailregex.test(string)){// valid email}else{// Invalid email}if (phoneregex.test(string)){// valid phone number}else{// Invalid phone number}

You can replace string with whatever you want. For Example:

if (phoneregex.test($("#phone").val())){// valid phone number}else{// Invalid phone number}

... [READ MORE]

Follow/Subscribe

Telegram 

Mastodon  Twitter

GitHub GitLab

Subdomains

Demos  Lab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab