Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,420,914 members, 5,430,093 topics. Date: Tuesday, 18 February 2020 at 09:21 PM

How Stuff Works: Regular Expressions - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / How Stuff Works: Regular Expressions (375 Views)

Revolving ,binary,vip,and Regular Matrix Web Development With All Payment / I Need A Regular Payoneer Buyer; I'm A Blogger / Regular 2017 Approved Adsense Account For Sale In Nigeria (2) (3) (4)

(1) (Reply)

How Stuff Works: Regular Expressions by DualCore1: 6:25pm On Sep 02, 2017
Regular expressions (RegEx) are quite handy in matching strings (or characters). As a developer, you would likely have to get your hands dirty with RegEx every now and then especially when you're working with complex form validations, .htaccess URL rewriting...yada yada. The whole thing looks scary at first glance... some RegEx combinations will get you thinking you're looking at a password with 100% strength.

You could choose to use one of the many online RegEx generators (and get the job done) or if you like to know what happens under the hood... let's say you like to know how the wheel works without having to reinvent it, then you should follow the link below to the best RegEx tutorial I have seen on the internet. I have included my personal notes on this subject below.

P.S: The link is not mine, it is just a very good resource to learn RegEx

Link
https://regexone.com/lesson/introduction_abcs

Personal Notes (expect typos, they are my notes tongue )
Quantifiers
+ = at least one
* = zero or more
? = zero or one
{N} = sequence of N characters
{2,3} = sequence 2 or 3, {min, max}
$ = ending with
^ = starting with

Metacharacters
\d matches digits 0-9
\D matches any non-digit characters
\w matches any alphanumeric character
\W any non-alphanomeric character
\s matches any whitespace character
\S matches any non-whitespace character


. matches any single character
[abc] matches only one of a, b or c
[^abc] matches any single character that is not a or b or c
[0-9] will match any single digit in the range of 0 - 9
[^a-d] will match any single character that's not in the range of a to d
() grouping and nested grouping can be done with parenthesis
| aka pipe will match different routes

2 Likes

(1) (Reply)

How To Convert Your Gmail To A Disposable Email Address / How To Start A Blog On Blogspot In 2018, Grow It And Make Money / Search Engine Optimization

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2020 Oluwaseun Osewa. All rights reserved. See How To Advertise. 31
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.