Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Cannot upper a string in a regex_replace

Cannot upper a string in a regex_replace

From: Wabiloo <fabre.lambeau_at_gmail.com>
Date: 31 May 2006 04:23:32 -0700
Message-ID: <1149074612.835488.66480@f6g2000cwb.googlegroups.com>


Using oracle 10g (10.2) on a Windows 2003 server

I'm trying to convert a comma-separated list of alphanumeric strings into a carriage-return-separated list of strings with bullet points and first letter as uppercase.

eg. "blue car,red rose,Yellow canari,radio control CD,massive, long, string"
should become
"- Blue car
- Red rose

As shown, the replacement only occurs when the comma is not followed by a space.

To do this, I have the following expression in my select statement: '-' || ' ' || regexp_replace ( col_features ,

                                    ',([^[:space:]])' ,
                                    chr(13) || chr(149) || ' ' ||
upper('\1') )

However, although the backreference ('\1') is working correctly (ie. I don't lose the non-space character following a space), the upper function does not seem to work. Indeed, what I get is: "- blue car
- red rose

If I surround the entire expression with upper(), I get every character uppercase, as expected, so this tells me that the function works. I therefore get the impression that it is to do with the backreference used in combination with the upper() function. Any idea why that is? Received on Wed May 31 2006 - 06:23:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US