in reply to One out of three ain't bad

Your grep solution would be intuitive to many monks, but it becomes more maintainable when paired with well-named variables or subroutines. My (current, and PBP-influenced) preferences: