RE: Regular Expression confusion

  • From: William B Ferguson <wbfergus@xxxxxxxx>
  • To: jkstill@xxxxxxxxx
  • Date: Thu, 21 Apr 2005 07:08:58 -0600

Hi Jared,
I'm Windows, so I don't have access to dump(). As a workaround, I modified
my original SQL statement (that almost works) accordingly, even grabbing a
couple different records:
SQL> select UPPER(regexp_replace(name,'[''''|"|;| |-|,|.]')) test_data,
asciistr(name) name,
2 ascii(substr(name,2,1)) code
3 from names
4 where upper(regexp_replace(name,'[[:punct:][:space:]]'))
5 like ('%JBU%')
6 and substr(name,2,1) = '-';

TEST_DATA              NAME                   CODE
---------------------- ---------------------- ----------
A-JBURKHART            A-J Burkhart           45
J-BUG                  J-Bug                  45

I've read and re-read the docs and articles I've been able to find, and it
seems like I should be able to escape the hyphen like '\-', but that's not
working in my character list.

As an aside, I thought the results returned by escaping the hyphen were
rather strange also.

Bill Ferguson
U.S. Geological Survey - Minerals Information Team
PO Box 25046, MS-750
Denver, Colorado 80225
Voice (303)236-8747 ext. 321 Fax (303)236-4208



From: jkstill@xxxxxxxxx [mailto:jkstill@xxxxxxxxx] 
Sent: Wednesday, April 20, 2005 5:52 PM
To: William B Ferguson
Cc: oracle-l@xxxxxxxxxxxxx
Subject: Re: Regular Expression confusion

Hi Bill,

Have you tried using dump() on the row?

It is possible that the '-' is not quite what you think it is.

Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist

Other related posts: