🚀 Seen my posts and want more? Dive deep into the issues with Big Tech at Escape Big Tech!

💡 Need FOSS-focused software solutions? Reach out on Matrix at @dannym:balooga.xyz!

  • 0 Posts
  • 1 Comment
Joined 1 year ago
cake
Cake day: June 14th, 2023

help-circle

  • Please don’t. Use regex to find something that looks like an IP then build a real parser. This is madness, its’s extremely hard to read and a mistake is almost impossible to spot. Not to mention that it’s slow.

    Just parse [0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3} using regex (for v4) and then have some code check that all the octets are valid (and store the IP as a u32).