Earlier quoted context omitted.
Isn’t the only difference between pop and imap that pop removes the mail from the server? I only use imap, and all my email is available offline.
Not at all. IMAP can do a lot of complex operations on the email while leaving it on the server, for example you can have the server search the email, flag it (mark it important, or read, or unread). POP can download the email, and that's about it.
What's up with all those equals signs anyway?
191–200 of 200 posts
Re: What's up with all those equals signs anyway?
#192Earlier quoted context omitted.
The regex answer is from the very old days of Stackoverflow, before fun was banned. I agree it barely qualifies as answer, but considering that the question has over 4 million page views (which almost puts it in the top 100 most viewed questions all-time), it has reached a lot people. The answer probably had much more influence than any serious answer on that topic. So I'd say the author did a good job.
People have shared it here and on reddit a bunch of times because it's funny. I always found the pragmatic counter-answer about using regex and the comments about how brittle it is to parse XML properly assuming a specific structure to be much more useful.
Re: What's up with all those equals signs anyway?
#193Earlier quoted context omitted.
If you already know where the start of the opening tag is, then I think a regex is capable of finding the end of that same opening tag, even in cases like yours. In that sense, it’s possible to use a regex to parse a single tag. What’s not possible is finding opening tags within a larger fragment of HTML.
For any given regex, an opponent can craft a string which is valid HTML but that the regex cannot parse. There are a million edge cases like: this! -—> but do count this --> and this --> but do count this —-> Now your regex has to include balanced comment markers. Solve that You need a context-free grammar to correctly parse HTML with its quoting rules, and escaping, and embedded scripts and CDATA, etc. etc. etc. I d…
A this! -—> but do count that -->Z
gets fixed and rendered as
A this! -—> but do count that -->Z
Another surprise is that
AZ
gets rewritten to
AZ
Note the insertion of extra `--` minus-hyphens.This is what MDN (https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Com...) has to say:
Comments start with the string ``, generally with text in between. This text cannot start with the string `>` or `->`, cannot contain the strings `-->` or `--!>`, nor end with the string `
Meaning that you can recognize HTML comments with (one branch of) a RegEx—you start wherever you see `Be it said that I find the precise rules too convoluted for what they do. Especially XML's prohibition on `--` in comments is ridiculous taken on its own. First you tell me that a comment ends with three characters `-->`, and then you tell me I can't use the specific substring `--`, either? And why can't I use `--!>`?
An interesting bit here is that AFAIK the `` or `` (XHTML) or `` (HTML) you could write `` to denote a tag with no content. We should have kept this IMO.
*EDIT* On the quoted HTML source you see things like `-—` (hyphen-minus, em-dash). This is how the Vivaldi DevTools render it; my text editor and HN comment system did not alter these characters. I have no idea whether Chrome's rendering engine internally uses these em-dashes or whether it's just a quirk in DevTool text output.
Re: What's up with all those equals signs anyway?
#194Re: What's up with all those equals signs anyway?
#195Earlier quoted context omitted.
It took me years to notice, but did you catch that the answer actually subtly misinterprets what the question is asking for? Guy (in my reading) appears to talk about matching an entire HTML document with regex. Indeed, that is not possible due to the grammars involved. But that is not what was being asked. What was being asked is whether the individual HTML tags can be parsed via regex. And to my understanding those…
The thing is, even when parsing html "correctly" (whatever that is) regexes will still be used. Sure, There will be a bunch of additional structures and mechanisms involved, but you will be identifying tokens via a bunch of regexes. So yes, while it is an inspired comidic genius of a rant, and sort of informative in that it opens your eyes to the limitations of regexes, it sort of brushes under the rug all the places…
Re: What's up with all those equals signs anyway?
#196Earlier quoted context omitted.
Not at all. IMAP can do a lot of complex operations on the email while leaving it on the server, for example you can have the server search the email, flag it (mark it important, or read, or unread). POP can download the email, and that's about it.
Yeah, because then the client can do whatever it wants with the messages. The operations don't need any further support from the protocol.
Gmail basically is IMAP with a couple extras, and your desktop (via a browser) and your phone (via a dedicated app) can both see the same messages. Only the phone can work offline though, because there is little demand for a dedicated desktop email client, it's always via a browser. But Google could easily make such a thing if they wanted.
Re: What's up with all those equals signs anyway?
#197Earlier quoted context omitted.
HTML comments do not nest. The obvious tokenizer you can create with regular expressions is the correct one.
If you're talking about tokenizers, then you're no longer parsing HTML with a regex. You're tokenizing it with a regex and processing it with an actual parser.
Re: What's up with all those equals signs anyway?
#198Earlier quoted context omitted.
People have shared it here and on reddit a bunch of times because it's funny. I always found the pragmatic counter-answer about using regex and the comments about how brittle it is to parse XML properly assuming a specific structure to be much more useful.
How is it more useful? Even if you insist on using regex, you'd primarily use it to fix the HTML so that it can be parsed, not to use regex itself to parse HTML.
Re: What's up with all those equals signs anyway?
#199Earlier quoted context omitted.
The regex answer is from the very old days of Stackoverflow, before fun was banned. I agree it barely qualifies as answer, but considering that the question has over 4 million page views (which almost puts it in the top 100 most viewed questions all-time), it has reached a lot people. The answer probably had much more influence than any serious answer on that topic. So I'd say the author did a good job.
Of all the things I wrote on SO, including many actually-useful detailed explanations, it was this drunken rant that stuck, for some reason.
Re: What's up with all those equals signs anyway?
#200CLRF vs LF strikes again. Partly at least. I wonder why even have a max line length limit in the first place? I.e. is this for a technical reason or just display related?
I am just wondering how it is good idea for a sever to insert some characters into user's input. If a collegue were to propose this, i d laugh in his face It's just sp hacky i cant belive it's a real life's solution