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
):
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
Post a Comment