EN
Regex - convert from camel case notation to underscore
14 points
To convert from camel case to underscore notation we can use below regex.
xxxxxxxxxx
1
Regex:
2
([a-z])([A-Z0-9])
3
4
Replace with:
5
\L$1_$2
6
7
// BEFORE:
8
dbColumnName
9
10
// AFTER:
11
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.
Screenshot before:

Screenshot after:

xxxxxxxxxx
1
// BEFORE:
2
pictureId
3
pictureHashId
4
pictureFilename
5
userId
6
pictureUploadTime
7
8
// AFTER:
9
picture_id
10
picture_hash_id
11
picture_filename
12
user_id
13
picture_upload_time