Let Ω be an arbitrary bounded domain of ℝⁿ . We study the right invertibility of the divergence on Ω in weighted Lebesgue and Sobolev spaces on Ω, and rely this invertibility to a geometric characterization of Ω and to weighted Poincare inequalities on Ω. We recover, in particular, well-known results on the right invertibility of the divergence in Sobolev spaces when Ω is Lipschitz or, more generally, when Ω is a John domain, and focus on the case of s-John domains.