I've finally made the effort to fully understand how to write my own regular expressions. In the past I just had no idea what something as cryptic as ^.+[a-zA-Z][a-zA-Z]\d\d\d\d\d\d.+?.pdf|^.+\w+\.xml (I just wrote that) meant.
Plugging that into my application now means that it fully validates my input, and does it perfectly. How did we manage before these things were invented?
If you want to learn more about regular expressions then take a look here.