Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Do you know assembly?
Good, Could you make me a small calculator, I need to port it to C# but assembly is easier to debug. -
Guava:
boolean isValid = InetAddresses.isInetAddress("1.2.3.4");
Supports both ip4 and ip6 -
I'd disagree it's easier to debug, but definitely easier to port to another language.
-
leksyib95436y
-
Flygger19816yAnother rant comes to mind ;)
https://devrant.com/rants/1381984/...
And before venturing in to craft your own RegEx for something trivial, you should consult one of the many places that have done it for you, e.g.: https://regular-expressions.info/ip...
Also, I really like the visual builder/debugger at https://regex101.com/ -
++ if your autocorrect also turns “regex” into “reflex”.
Regex should never be a reflex...
But at the same time, I have nothing against it. Just that most people don’t take the time to actually figure it out. -
I think Jake from the HTTP203 Podcast put it best:
"Regex are writeonly for me. Once I've written one I can close my eyes for three seconds and not understand a single thing."
This shit is real.
Guy comes to my desk.
Guy: Do you know Python?
Me: Yes
Guy: I want a program that reads a CSV containing IP addresses and tells which of them are valid.
Me: Sure thing. Show me the CSV file.
Guy: (Shows the file)
Me: (Writes a small function for checking whether the IP is valid)
Me: Done Here you go.
Guy: You should be using regex.
Me: Why? This is perfect. No need for regex.
Guy: My manager wants a solution using regex only.
Me: Why so?
Guy: I don't know. Can you do it using regex?
Me: Only if you say so. (Stackoverflow. Writes a humongous regex). Done!
Me: Just for curiosity, what is your application?
Guy: I will port it in Java. You see, regex is easy to debug.
Me: Ohhh Yes. I forgot that. Good luck with your regex.
rant