Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Regular Expression function to convert the first letter after a digit to Uppercase

2756488Sep 22 2014 — edited Sep 22 2014

Hi,

I am trying to do this using regular expression functions, but its not giving me the results I need.

Input String: '122nd Street'

Desired Output: '122Nd Street'

I tried using regexp_substr to pull the first word in the string (122nd) and then using a combination of regexp_replace and initcap to make the first letter after the digits, to uppercase.

select regexp_substr('122nd Street', '^([0-9]+[[:alnum:]]+)') from dual

Also, do you think this should work?

select REGEXP_REPLACE('452nd', '([0-9]+)([[:alpha:]+])', '\1initcap(\2)')from dual

May be I'm not using the initcap in the right way? Any help is appreciated.

Thank you,
Shalini

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 20 2014
Added on Sep 22 2014
6 comments
2,003 views