Skip to content

Instantly share code, notes, and snippets.

@carellen
Last active July 29, 2021 10:37
Show Gist options
  • Save carellen/f9795bcbea741b0bcb0daa496f508bba to your computer and use it in GitHub Desktop.
Save carellen/f9795bcbea741b0bcb0daa496f508bba to your computer and use it in GitHub Desktop.
Use postgresql regexp_replace in rails
Model.where("column LIKE ?", "%column content%").update_all("column = regexp_replace(column, 'regexp here', 'new content')")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment