3 ms·
This site reminded me the times when I interviewed candidates. One of the interview problems was to write a function that would validate if a given string was a
by xtracto 5y ago
This site reminded me the times when I interviewed candidates. One of the interview problems was to write a function that would validate if a given string was a valid IPv4 address (a la 10.10.10.1).
Some of the candidates started by saying: "I know! I'll use a Regular Expression", to what I replied: "Great!, now you have TWO problems!"
- alisonkisk 5y agothis should do it: ^((1\d\d|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.){3}(1\d\d|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])$ Was the second problem "the interviewer"?
- ErikCorry 5y agoDoesn't match 10.0.0.55 No hire :-)
- benibela 5y agoFun fact: 2134567890 is a valid IPv4 address You can try and ping it