Live data from Hacker News

Preventing line breaks in elements

alexwlchan.net

11–20 of 23 posts

Re: Preventing line breaks in <code> elements

#13
post #9
post #2

You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML.

Some commenters are missing that this is a reference to https://stackoverflow.com/a/1732454 .

Good ol' appeal to emotion devoid of technical argument.

Re: Preventing line breaks in <code> elements

#14
post #7
post #2

You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML.

What do you mean you can't. I do it all the time

You do some parts all the time.

Re: Preventing line breaks in <code> elements

#16
post #9
post #2

You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML.

Some commenters are missing that this is a reference to https://stackoverflow.com/a/1732454 .

> Locked. There are disputes about this answer’s content being resolved at this time [sic]

And also

> Nov, 2020

And then, StackOverflow asks itself why it looses users.

Re: Preventing line breaks in <code> elements

#17
post #9

Earlier quoted context omitted.

Some commenters are missing that this is a reference to https://stackoverflow.com/a/1732454 .

> Locked. There are disputes about this answer’s content being resolved at this time [sic] And also > Nov, 2020 And then, StackOverflow asks itself why it looses users.

The answer is actually from 2009. As long as HTML/XML doesn’t suddenly become a regular language, I think it’s pretty timeless.

Re: Preventing line breaks in <code> elements

#18
post #8
post #2

You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML.

You can absolutely parse HTML with regex, so long as the document is finite in length. Every finite language is regular, hence can be parsed with regex's.

Zalgo and situational subset parsing aside:

> You can absolutely parse HTML with regex, so long as the document is finite in length

This isn't sufficient, unless I'm misinterpreting what you're saying. It's not enough to have documents of finite length (all documents are finite in length), you need documents with a max length, so you have a finite number of possible documents to parse.

Re: Preventing line breaks in <code> elements

#19
post #9

Earlier quoted context omitted.

Some commenters are missing that this is a reference to https://stackoverflow.com/a/1732454 .

> Locked. There are disputes about this answer’s content being resolved at this time [sic] And also > Nov, 2020 And then, StackOverflow asks itself why it looses users.

It's a 17 year old joke, maybe one of the most famous on stackoverflow for the aging engineers out there. No one wants new "funny" edits on it.

Re: Preventing line breaks in <code> elements

#20
post #8
post #2

You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML.

You can absolutely parse HTML with regex, so long as the document is finite in length. Every finite language is regular, hence can be parsed with regex's.

[deleted]
Post reply on HN