Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,209,420 members, 8,006,011 topics. Date: Monday, 18 November 2024 at 02:38 PM |
Nairaland Forum / Science/Technology / Webmasters / How Stuff Works: Regular Expressions (686 Views)
Google’s Top Searches Of 2019 In Nigeria Shows Some Crazy Stuff / I'll Build An Ecommerce Website/online Store Where You Can Be Selling Your Stuff / What Is Seo? Important Stuff To Note (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 ) 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)
Digi Clan Lagos Meetup. / Do You Own A Business & Wish To Target Major Nigeria Companies &business Come In / I Need This Type Of Site Anyone With A Configurable Script
(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 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10 |