Wednesday, March 23, 2011

The B, C and D's of Learning Regex...

.net Funda - B- Ball, C- Cat, D – dog: - Learning (REGEX) regular expression the easy way.

So, what’s the agenda?
Just in case if you are new comer, what is regex?
3 important regex commands
Check if the user has entered shivkoirala?
Let’s start with the first validation, enter character which exists between a-g?
Enter characters between [a-g] with length of 3?
Enter characters between [a-g] with maximum 3 characters and minimum 1 character?
How can I validate data with 8 digit fix numeric format like 91230456, 01237648 etc?
How to validate numeric data with minimum length of 3 and maximum of 7, ex -123, 1274667, 87654?
Validate invoice numbers which have formats like LJI1020, the first 3 characters are alphabets and remaining is 8 length number?
Check for format INV190203 or inv820830, with first 3 characters alphabets case insensitive and remaining 8 length numeric?
Can we see a simple validation for website URL’s?
Let’s see if your BCD works for email validation?
Short cuts
Quick references for regex

So, what’s the agenda?

Regex has been the most popular and easiest way of writing validations. The only big problem with regex has been the cryptic syntax. Developers who are working on projects with complicated validation always refer some kind of cheat sheet to remember the syntaxes and commands.

In this article we will try to understand what regex is and how to remember those cryptic syntaxes easily.




I regex about once a year, maybe. And like most it usually ends up being GBC (google based code). And every time I mean to learn it better, but then something comes up, yada, yada, yada. Well the next time I'm first going to review the above post (and then probably GBC it... but learning is a life long process, right?  :)

No comments: