camelCase to snake_case

Paste your text: every likeThis becomes like_this (snake_case, lowercase).

What it's for

This is the direction you need going from code to a database, or when a project settles on one convention and what exists has to be rewritten: from birthDate to birth_date, over a whole list in one go. It also helps to make readable the names taken from a configuration file or a web service reply, where run-together capitals turn everything into one block.

The hard part is acronyms

Putting an underscore before every capital is the naive solution, and on getHTTPResponse it would give get_h_t_t_p_response, a name worse than the one you started with. Here the acronym is recognized and kept together: the cut is made where the run of capitals ends and a new word begins, so the result is get_http_response. That's the difference between a conversion you can use and one you have to fix by hand.

What happens to the rest

At the end the whole text is put into lowercase, which is the form snake_case is written in. So UserName becomes user_name and a name already in lowercase stays as it is. Digits don't open a new word: value2 stays whole, while value2X becomes value2_x. The rest of the line, punctuation included, isn't touched.

Nearby tools

The opposite direction is snake_case → camelCase. For a web address, which wants ordinary dashes, there is Make a URL slug; to make tabs consistent before moving the code into another editor, Tabs to spaces.