I was surprised to see this Tumblr post describe ~んだった used to mark regret. I can only assume it's true, but I'm not sure (1) how much of a colloquial expression/slang is it? (2) what does it come from, grammatically?
I'm familiar with のだ → んだ, but that doesn't seem like the past form (past+んだ) so is it maybe some kind of abbreviation of んだったらいい? It doesn't really make sense though... and I couldn't really find anything anywhere else!
すればよかった
is more normal.日本人が言うのを聞いても、もしかしたら理解できないときがあるかもしれない