Top community members
All Wiki Articles Create Wiki Article

Many years me and my friends we were volunteers on my university doing programming classes for young people.

I got main conclusion: Young people are awesome, especially students, because they always bring new and fresh ideas :)
* I loved to do it but my time is limited

  I decided to create something that will help millions of students

Now I am here

co-founder

Regex - convert from camel case notation to underscore

0 contributions
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:

Regex to convert from camel case to underscore notation - before replace
Regex to convert from camel case to underscore notation - before replace

Screenshot after:

Regex to convert from camel case to underscore notation - after replace
Regex to convert from camel case to underscore notation - after replace

More complex example

// BEFORE:
pictureId
pictureHashId
pictureFilename
userId
pictureUploadTime

// AFTER:
picture_id
picture_hash_id
picture_filename
user_id
picture_upload_time

See also

  1. Regex - convert from underscore to camel case notation
0 contributions

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more