A regular expression would be the least amount of code to write.