sql - Split by uppercase Oracle -
i loooking regex expression or :
------------------------ | id | prop_name | ------------------------ | 1 | isthisanexample | ------------------------
to :
----------------------------- | id | prop_name | ----------------------------- | 1 | example | -----------------------------
of course cool if first character uppercase , if other words start lowercase. spliting them okay.
maybe regexp looking for
"insert blank between each lower case character followed upper case character":
select regexp_replace('isthisanexample', '([[:lower:]])([[:upper:]])', '\1 \2') dual
first character can replaced upper case letter
select upper(substr('isthisan example', 1,1))||substr('isthisan example', 2) dual;
so, first replace first character , regexp_replace result:
select regexp_replace(upper(substr('isthisan example', 1,1))||substr('isthisan example', 2), '([[:lower:]])([[:upper:]])', '\1 \2') dual;
if first character of sentence should upper case letter, try:
select upper(substr(regexp_replace('isthisanexample', '([[:lower:]])([[:upper:]])', '\1 \2'),1,1))|| lower(substr(regexp_replace('isthisanexample', '([[:lower:]])([[:upper:]])', '\1 \2'),2)) dual
Comments
Post a Comment