would this be better /^\{\s*|\s*\}$/