Since posting
this thread on the web development forum several months ago I've gotten very involved with regular expressions. If anyone needs some help understanding or constructing a regex, lemme know in this thread and I'll be happy to try to help as time permits.
For those who have no idea what I'm talking about, a regular expression is a special text string for describing a search pattern...basically wildcards on steroids. For example, here's a regex that will find most any valid email address:
\b[a-z\d._%-]+@(?:[a-z\d-]+\.)+[a-z]{2,6}\b
That will match "
[email protected]", but not "
[email protected]" or other invalid email address.
I could use that e.g. to check if someone entered a real email address in a web page, or I could replace it with whatever I want, which may incorporate all or only parts of the match (e.g. I could turn it into an HTML link).
Or maybe I want to find valid email addresses that are from anywhere but able2know.com ...to do so I'd adjust the regex pattern like so:
\b[a-z\d._%-]+@(?!able2know\.com\b)(?:[a-z\d-]+\.)+[a-z]{2,6}\b
As a web application developer, I now rely on regexes constantly in my work, but they can be very useful for non-developers as well (e.g. Microsoft Word allows advanced search and replace with a sort of quasi-regex support, and a number of other text editors including
EditPad, which offers a nearly full-featured free version, support regex).
Want to take a list of names in Word and convert them to "Lastname, Firstname" format, or find any number that doesn't start with 0, or extract all phone numbers from a document, etc., etc.? A regular expression can help...