Regex replace uppercase with lowercase letters in PhpStorm -


hey have change in lot of places camelcase snail_case.

i have following example:

billingaddress paymentdetails 

i tried use find , replace regex in phpstorm

in 'find' input field put in:

([a-z]) 

in 'replace' input field put in:

_\l$1 

result got:

billing_laddress payment_ldetails 

what need change in order following result:

billing_address payment_details 

first open find , replace functionality ctrl + r , check boxes match case , regex (and if necessary in selection):

enter image description here


1. replace camelcase snail_case in in question:

find: ([a-z])
replace: _\l$1

something -> some_thing


2. replace uppercase words lowercase words use \l

find: (\w*)
replace: \l$1

something -> something


3. replace lowercase words uppercase words use \u

find: (\w*)
replace: \u$1

something -> something


4. replace first character of words lowercase use \l

find: (\w*)
replace: \l$1

something -> something


5. replace first character of words uppercase use \u

find: (\w*)
replace: \u$1

something -> something


note: add boundaries

you best results adding additional boundaries suit specific case, example single ' or double quotes " or line breaks \n


regex documentation

check details on additional regular expression syntax documentation phpstorm or webstorm.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -