Created
October 4, 2019 09:12
-
-
Save sgabber/38233b47cc9bfd6bf49ac14626a61268 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From camelcase to db column name | |
find | |
/([a-z_]*)([A-Z])(.*?$)/ | |
replace with | |
/\1_\l\2\3/ | |
repeatedly | |
from db column name to camelcase (table name should be only lowercase and underscores) | |
find | |
/([a-z]*)_([a-z])/ | |
replace with | |
/\1\u\2/ | |
find all double quotes out of square brackets (to convert them to single quotes) | |
find | |
(?<!\])"(?!\[) | |
replace | |
' | |
sample case: "["testing","of","regex"]" -> "['testing','of','regex']" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment