Robust email address validator – with address suggestions!

I’m sure you’ve seen the simple email address format validation function; they’re usually a simple regular expressing that just check the address portion (the user@example.org bit). That’s really only a bit of the validation that should be done. The RFC822 specs detail that the format of email addresses can be much larger, for example, it could be something like “Andrew Collington & Co.” <a.collington@example.org>, and, of course, the simple regex on that would fail. But even a check on the address format isn’t often enough… The user could enter a correctly formatted email address but simply have mis-spelled the address… they may accidentally type in user@yahooo.com, or user@hitmail.co.uk rather than hotmail.co.uk, and things like that. In which case you may want to check the MX and/or A record to see if its a valid domain. And whilst you’re doing that, why not check to see if it’s a commonly used email host that maybe they’ve typed in wrong?

So here is a class that will allow you to do all that in one easy method call:

Continue reading “Robust email address validator – with address suggestions!”

Did you like this? Share it:

Getting a list of project tags from Subversion

So there you are nicely tagging your project in Subversion, but for some reason you need to get a list of all the tags being used… That situation came up for me today. I thought it was going to be some really complex way of getting the tags, involving the use of hook scripts and the like. But it turns out that with some command line goodness it’s actually much more simple. Here’s how to do it:

svnlook tree --full-paths /home/path/to/svn/project | \
egrep -a '/?tags/.+' | \
sed -re 's!.*/?tags/([^/]*).*!\1!' | \
sort -u
Did you like this? Share it:

Easy chained select lists using Zend Framework and Prototype

Building a set of select lists that are dependant of each other can be a daunting task, but for a simple two-level list – in that what you select from one drop-down will changing what’s displayed in one or more other drop-downs – is actually quite easy thanks to Zend Frameworks and Prototype, both of which support Json.

Continue reading “Easy chained select lists using Zend Framework and Prototype”

Did you like this? Share it: