"The data validation requirements for a telephone number are dead simple," writes Chris M., "Just the numbers and that's it. The user can enter their numbers with dashes, brackets, parens, whatever.  Only the numbers should be saved."

"You would think that filtering out the non-numeric characters should be a simple thing to do with regluar expressions or heck, even walking the string would be feasible."

"Alas, the original developer decided to take the scenic route. Tháñk göödñéss ñóbódÿ üsés wíërd sɹǝʇʇǝן!"

#make sure that the phone numbers have no bad characters in them 
homephone = homephone.replace(" ", "").replace("-", "").replace("(", "")
homephone = homephone.replace(")", "").replace("[", "").replace("]", "") 
homephone = homephone.replace(".", "").replace("`", "").replace("^", "")
homephone = homephone.replace("!", "").replace("@", "").replace("#", "") 
homephone = homephone.replace("$", "").replace("%", "").replace("&", "")
homephone = homephone.replace("*", "").replace("+", "").replace("=", "") 
homephone = homephone.replace("/", "").replace("<", "").replace(">", "")
homephone = homephone.replace(":", "").replace(";", "").replace("~", "") 
homephone = homephone.replace("A", "").replace("B", "").replace("C", "")
homephone = homephone.replace("D", "").replace("E", "").replace("F", "") 
homephone = homephone.replace("G", "").replace("H", "").replace("I", "")
homephone = homephone.replace("J", "").replace("K", "").replace("L", "") 
homephone = homephone.replace("M", "").replace("N", "").replace("O", "")
homephone = homephone.replace("P", "").replace("Q", "").replace("R", "") 
homephone = homephone.replace("S", "").replace("T", "").replace("U", "")
homephone = homephone.replace("V", "").replace("W", "").replace("X", "") 
homephone = homephone.replace("Y", "").replace("Z", "").replace("a", "")
homephone = homephone.replace("b", "").replace("c", "").replace("d", "") 
homephone = homephone.replace("e", "").replace("f", "").replace("g", "")
homephone = homephone.replace("h", "").replace("i", "").replace("j", "") 
homephone = homephone.replace("k", "").replace("l", "").replace("m", "")
homephone = homephone.replace("n", "").replace("o", "").replace("p", "") 
homephone = homephone.replace("q", "").replace("r", "").replace("s", "")
homephone = homephone.replace("t", "").replace("u", "").replace("v", "") 
homephone = homephone.replace("w", "").replace("x", "").replace("y", "")
homephone = homephone.replace("z", "") 

workphone = workphone.replace(" ", "").replace("-", "").replace("(", "")
workphone = workphone.replace(")", "").replace("[", "").replace("]", "") 
workphone = workphone.replace(".", "").replace("`", "").replace("^", "")
workphone = workphone.replace("!", "").replace("@", "").replace("#", "") 
workphone = workphone.replace("$", "").replace("%", "").replace("&", "")
workphone = workphone.replace("*", "").replace("+", "").replace("=", "") 
workphone = workphone.replace("/", "").replace("<", "").replace(">", "")
workphone = workphone.replace(":", "").replace(";", "").replace("~", "") 
workphone = workphone.replace("A", "").replace("B", "").replace("C", "")
workphone = workphone.replace("D", "").replace("E", "").replace("F", "") 
workphone = workphone.replace("G", "").replace("H", "").replace("I", "")
workphone = workphone.replace("J", "").replace("K", "").replace("L", "") 
workphone = workphone.replace("M", "").replace("N", "").replace("O", "")
workphone = workphone.replace("P", "").replace("Q", "").replace("R", "") 
workphone = workphone.replace("S", "").replace("T", "").replace("U", "")
workphone = workphone.replace("V", "").replace("W", "").replace("X", "") 
workphone = workphone.replace("Y", "").replace("Z", "").replace("a", "")
workphone = workphone.replace("b", "").replace("c", "").replace("d", "") 
workphone = workphone.replace("e", "").replace("f", "").replace("g", "")
workphone = workphone.replace("h", "").replace("i", "").replace("j", "") 
workphone = workphone.replace("k", "").replace("l", "").replace("m", "")
workphone = workphone.replace("n", "").replace("o", "").replace("p", "") 
workphone = workphone.replace("q", "").replace("r", "").replace("s", "")
workphone = workphone.replace("t", "").replace("u", "").replace("v", "") 
workphone = workphone.replace("w", "").replace("x", "").replace("y", "")
workphone = workphone.replace("z", "") 

cellphone = cellphone.replace(" ", "").replace("-", "").replace("(", "")
cellphone = cellphone.replace(")", "").replace("[", "").replace("]", "") 
cellphone = cellphone.replace(".", "").replace("`", "").replace("^", "")
cellphone = cellphone.replace("!", "").replace("@", "").replace("#", "") 
cellphone = cellphone.replace("$", "").replace("%", "").replace("&", "")
cellphone = cellphone.replace("*", "").replace("+", "").replace("=", "") 
cellphone = cellphone.replace("/", "").replace("<", "").replace(">", "")
cellphone = cellphone.replace(":", "").replace(";", "").replace("~", "") 
cellphone = cellphone.replace("A", "").replace("B", "").replace("C", "")
cellphone = cellphone.replace("D", "").replace("E", "").replace("F", "") 
cellphone = cellphone.replace("G", "").replace("H", "").replace("I", "")
cellphone = cellphone.replace("J", "").replace("K", "").replace("L", "") 
cellphone = cellphone.replace("M", "").replace("N", "").replace("O", "")
cellphone = cellphone.replace("P", "").replace("Q", "").replace("R", "") 
cellphone = cellphone.replace("S", "").replace("T", "").replace("U", "")
cellphone = cellphone.replace("V", "").replace("W", "").replace("X", "") 
cellphone = cellphone.replace("Y", "").replace("Z", "").replace("a", "")
cellphone = cellphone.replace("b", "").replace("c", "").replace("d", "") 
cellphone = cellphone.replace("e", "").replace("f", "").replace("g", "")
cellphone = cellphone.replace("h", "").replace("i", "").replace("j", "") 
cellphone = cellphone.replace("k", "").replace("l", "").replace("m", "")
cellphone = cellphone.replace("n", "").replace("o", "").replace("p", "") 
cellphone = cellphone.replace("q", "").replace("r", "").replace("s", "")
cellphone = cellphone.replace("t", "").replace("u", "").replace("v", "") 
cellphone = cellphone.replace("w", "").replace("x", "").replace("y", "")
cellphone = cellphone.replace("z", "") 
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!