←back to thread

314 points Bogdanp | 1 comments | | HN request time: 0s | source
Show context
timewizard ◴[] No.44380241[source]
I've personally never felt comfortable using regexes to solve production problems. The certificate code referenced here shows why:

https://github.com/mozilla-firefox/firefox/blob/d5979c2a5c2e...

Yikes.

replies(3): >>44380967 #>>44381082 #>>44381215 #
baobun ◴[] No.44381215[source]
Unless you see a glaring issue I don't: I think you are getting the causality wrong there. You "Yikes" because of your discomfort and lack of practice with regexes.
replies(1): >>44381413 #
timewizard ◴[] No.44381413[source]
> You "Yikes" because of your discomfort and lack of practice with regexes.

That's exceptionally presumptions to the point of being snotty.

> I think you are getting the causality wrong there.

Where did I imply causality? This was simply an occasion to look at the code. This is bad code. I would not pass this. What's your _justification_ for using a regex here?

replies(1): >>44382487 #
1. baobun ◴[] No.44382487[source]
> Where did I imply causality?

> > The certificate code referenced here shows why

So what's the implication here, then?

> This is bad code.

Without justifying further I think we're on equal footing on the snottiness here (:

What's bad? Why not use regex here? It's not like they're using it to parse user-controlled HTML. Simple string transormations like this is a great use-case where the manual character iteration easily becomes inefficient and messy. And you may introduce bugs in the process (unicode length bugs are common).

Do you also avoid grep and sed without the -F flag in shell?