EN
Regex - convert from camel case notation to underscore
14
points
To convert from camel case to underscore notation we can use below regex.
Regex:
([a-z])([A-Z0-9])
Replace with:
\L$1_$2
// BEFORE:
dbColumnName
// AFTER:
db_column_name
Tested with notepad++.
Notes:
- ensure to have 'Match case' radio button checked,
- ensure to have 'Regular expression' radio button checked.
Motivation:
Why I like to use it?
Because I don't need to convert SQL field names manually and it saves my time.
Screenshots
Screenshot before:
Screenshot after:
More complex example
// BEFORE:
pictureId
pictureHashId
pictureFilename
userId
pictureUploadTime
// AFTER:
picture_id
picture_hash_id
picture_filename
user_id
picture_upload_time