News for hackers. Stuff that matters.
Re:In search of the perfect URL validation regex (2010) by tester756 on Saturday September 25, 2021 @08:20PM (#28657282)
>So, does this apply to URLs? The fact that these regexes are....so huge...makes me think that something is fundamentally wrong

Yes, if your regex is above {.../50/100/...} characters, then write parser.

I struggle to understand why do people write those crazy regexes for emails, urls, html when probably in all popular technologies there are battle-tested parsers for those things.

Re:In search of the perfect URL validation regex (2010) by Too on Sunday September 26, 2021 @03:07AM (#28659007)
On top of this the error messages with a regex will be very one-dimensional.

As an example, http://localhost/ is technically valid url, which he wants to block. Should this error say misformatted URL like all others?

Using regex to cover all such cases is really the wrong tool for the job.

Re:In search of the perfect URL validation regex (2010) by staticassertion on Saturday September 25, 2021 @08:34PM (#28657368)
Sometimes you're given an arbitrary bag of bytes with best-effort well-formed data. Regexes are gross but quite good for those cases where you need to try to rip out some bits from the data abyss.