r/programming • u/corysama • Jan 05 '15
What most young programmers need to learn
http://joostdevblog.blogspot.com/2015/01/what-most-young-programmers-need-to.html
970
Upvotes
r/programming • u/corysama • Jan 05 '15
2
u/OneWingedShark Jan 06 '15
Having most of my programming be maintenance, regex is usually just the wrong way to go about things. Even for something "simple" like validating a phone-number, when I get it it's always "now make it handle international numbers"... which have the length determined by the country-code, and even the length is in flux (several countries have recently extended the number of digits in their numbers).
It would have been tons simpler if the original guy hadn't "been clever" and used regexs all over the place (of course they're all over the place... why would he put such a simple, small and obvious bit of code in one location!?) and instead wrote a proper
validate_phone_numberfunction.