My knowledge of analysis is admittedly awful, and the following situation has come up in a paper I'm reading: Suppose that $f \in H^2([0,1])$ has the property that $f''(x) = ax + b\ $ a.e. on $(a,b) \subset [0,1]$, where $f''$ denotes the weak second derivative of $f$. The authors claim without further justification that this implies that $f \vert_{[a,b]}$ is smooth, but I'm not sure how to convince myself of this.
My best guess is that $f''$ being smooth a.e. implies that $f$ is smooth a.e. (is this correct?). But since $f \in H^2([0,1])$, Sobolev embeddings imply that it is absolutely continuous, and hence must in fact be smooth everywhere.