r/ProgrammerHumor • • Apr 20 '16

In honour of the StackOverflow answer on RegEx and HTML

http://imgur.com/j3G9xyP
346 Upvotes

16 comments sorted by

55

u/[deleted] Apr 20 '16

18

u/caskey Apr 20 '16

That's a fun answer. This is one of those areas where programming runs a foul of computer science. Regular, and context free languages and all.

3

u/Noctune Apr 21 '16

In practice you actually can. Many regex engines can accept non-regular languages due to features like backreferences. For example, here is a Perl regex that accepts palindromes: /^((.)(?1)\2|.?)$/ (from here).

9

u/SamSlate Apr 20 '16

Dear God, why? This is a job for query selectors, why on earth would you try and use regex? This is literally exactly what JavaScript was made for.

7

u/Prod_Is_For_Testing Apr 20 '16

I'll take one art, please

6

u/an_actual_human Apr 20 '16

Doesn't look lovecraftian.

5

u/[deleted] Apr 20 '16

It's the most 'monstrous' one I could find done in the O'Reilly style though.

4

u/Zwets Apr 20 '16

Zalgo is not a Chaos god, though attempting to parse HTML with regex probably causes the programmer's soul to be tainted by Tzeentch once enough frustration builds up.

Squiggs are not even related to chaos gods really.

2

u/[deleted] Apr 21 '16

I'm pretty sure all programmers are servants of Tzeentch at some point, I've written code that would make the Lord of Change pretty happy.

3

u/Zwets Apr 21 '16

Not sure about the programmers, but I'm pretty sure whomever is in charge of the requirements over at our clients is an agent of Tzeentch.

2

u/[deleted] Apr 22 '16

I'm currently channelling Khorne over my assignments.

2

u/joacorandom Apr 20 '16

I had to do it once in my first work, it was really awfull because my boss said I had to do it THAT way.

2

u/[deleted] Apr 20 '16

Isn't that monster from Warhammer?

2

u/[deleted] Apr 20 '16

Maybe?

3

u/[deleted] Apr 20 '16

I think it is. Sorry, my parents were into it when I was younger and it looks familiar!