So finally I’ve started into Regular Expressions. 😀
After been consistently realising the need for getting all wet in RegEx but fearing the cold waters, I started on RegEx yesterday when I built a validation class in PHP for a project that I’m working on, heavily using RegEx. About 99% of validation is being done by way of RegEx & I know that many tasks can be done with RegEx quite efficiently, as someone told me sometime back that RegEx are resource hungry if not optimally used, I simply built this class using RegEx just to see that I too can do it. 😉
I knew RegEx are great but working with them is more cool, its just amazing that how some small tit bits of illeligible strings can match text with such precision.
For example, take into account this RegEx that I wrote to validate a person’s name.
This RegEx will allow only alphabets(in either case) and white spaces in the text with a minimum length of 4 & a maximum length of 32. No numbers or special characters allowed as whosoever heard of a name like Amit-Gupta_09? 😉
Doing RegEx has been made wonderful by The Regulator. Its a FREE RegEx testing tool with great features & I’d recommend it to anyone writing RegEx. It can analyse your RegEx to tell you what your pattern will do & you can enter an input to check if your RegEx is working or not. 😀
The Regulator is done in .NET & requires you to have .NET Framework installed on your machine before you install The Regulator. If you don’t have .NET Framework, then you can get v1.1 from Microsoft.com.
Another in-despensable resource is the RegEx Library where you can get hundreds of RegEx for various tasks for free. 😀 Also, you wouldn’t want to miss out on Regular-Expressions.info as its a good reference for using RegEx, with a detailed RegEx Tutorial. I saved all of that tutorial to browse & learn while offline but I’m ashamed to say that like many things I know, I learned RegEx also by trying them out live instead of reading a tut on it & then applying it. 😳
Will this mean an end to my dependence on others for RegEx? Certainly not but it will definitely lessen my dependence on others, allowing them to breathe. 😀 😉