How to construct Perl regex to replace (lowercase followed by uppercase) by (lowercase. uppercase)? -


i write perl regex replace pattern other pattern. source pattern lowercase followed uppercase. destination pattern lowercase followed dot, space , uppercase.

here example:

camelcase 

i want change following:

camel. case 

thanks in advance!

i suggest following:

$stringtoconvert = s/([a-z][a-z]+)(?=[a-z])/$1\. /g; 

the positive ahead "(?=[a-z])" key. words replaced have capitalized character in front of it.

also note "g" means search string globally. results in following:

camelcase camel. case 

as as

camelcasemultiple camel. case. multiple 

and on , on many capitalized words there may in string.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -