URL Regular Expression (Regex)

Here’s a regular expression to match URLs based on the RFC 3986. This example uses PHP. [cc lang=”php”] $scheme = “(https?)://”; $userinfo = ‘([“+a-z0-9-._~+”]+(:[“+a-z0-9-._~+”]+)[email protected])?’; $host = ‘([([0-9a-f]{1,4}|:)(:[0-9a-f]{0,4}){1,7}((d{1,3}.){3}d{1,3})?]|[“+a-z0-9-+”]+(.[“+a-z0-9-+”]+)*)’; $port = “(:d{1,5})?”; $path = ‘(/(([“+a-z0-9-._~!$&’ . “‘()*+,;=:@+” . ‘]|”+%[0-9a-f]{2}+”)+)?)*’; $query = ‘(?(([“+a-z0-9-._~!$&’ . “‘()*+,;=:@+” . ‘”/”+”?”+”]|”+%[0-9a-f]{2}+”)+)?)?’; $fragment = ‘(#(([“+a-z0-9-._~!$&’ . “‘()*+,;=:@+” . ‘”/”+”?”+”]|”+%[0-9a-f]{2}+”)+)?)?’; [/cc]

Read More

Different Types of CAPTCHA

Recently I needed to improve CAPTCHA on a website. Here are the different types of CAPTCHAs I found. Web Service (Google reCAPTCHA) Locally-Run (Securimage PHP CAPTCHA) CSS (Honeypot / Invisible) CAPTCHA Video CAPTCHA (NuCAPTCHA) Math CAPTCHA (generate 2 numbers to add or something else only humans can evaluate and have them enter the correct value […]

Read More