Home » SQL & PL/SQL » SQL & PL/SQL » regular expression (oracle 10g, Windows)
regular expression [message #424344] Thu, 01 October 2009 11:34 Go to next message
balji_dxb
Messages: 37
Registered: October 2007
Member
I have a regular expression ^[[:alnum:]( .)]*$. it allows only alphanumberic but if my data is like 'abc-dfdf' or 'a-dfdf' it fails. how do i change it.

i am using oracle 10g
Re: regular expression [message #424346 is a reply to message #424344] Thu, 01 October 2009 11:53 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Add - in the allowed list.

Regards
Michel
Re: regular expression [message #424347 is a reply to message #424344] Thu, 01 October 2009 11:57 Go to previous messageGo to next message
BlackSwan
Messages: 24915
Registered: January 2009
Senior Member
>how do i change it.
First remove the dash characters.
Re: regular expression [message #424348 is a reply to message #424347] Thu, 01 October 2009 12:15 Go to previous messageGo to next message
balji_dxb
Messages: 37
Registered: October 2007
Member
I WANT TO ALLOW '-'
Re: regular expression [message #424358 is a reply to message #424348] Thu, 01 October 2009 13:35 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Michel Cadot wrote on Thu, 01 October 2009 18:53
Add - in the allowed list.

Regards
Michel

Re: regular expression [message #424359 is a reply to message #424358] Thu, 01 October 2009 13:41 Go to previous messageGo to next message
balji_dxb
Messages: 37
Registered: October 2007
Member
What is syntax to add '-' in the allowed list
Re: regular expression [message #424360 is a reply to message #424359] Thu, 01 October 2009 13:49 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Do you understand the expression you posted?

regards
Michel
Re: regular expression [message #424361 is a reply to message #424360] Thu, 01 October 2009 14:29 Go to previous messageGo to next message
balji_dxb
Messages: 37
Registered: October 2007
Member
i am new to regular expression
Re: regular expression [message #424362 is a reply to message #424361] Thu, 01 October 2009 14:33 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes but this does not answer my question.

Regards
Michel
Re: regular expression [message #424363 is a reply to message #424362] Thu, 01 October 2009 14:42 Go to previous messageGo to next message
balji_dxb
Messages: 37
Registered: October 2007
Member
The expression will allow Alpha number character with '.' at the end. thats what i understand from the expression
Re: regular expression [message #424366 is a reply to message #424363] Thu, 01 October 2009 15:12 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No, it allows all characters that are between the outer [].

Regards
Michel
Re: regular expression [message #424374 is a reply to message #424344] Thu, 01 October 2009 20:05 Go to previous messageGo to next message
BlackSwan
Messages: 24915
Registered: January 2009
Senior Member
Post DDL for tables.
Post DML for test data.

Post expected/desired results
Post detailed explanation how & why test data gets transformed into expected/desired results.
Re: regular expression [message #424389 is a reply to message #424344] Fri, 02 October 2009 01:05 Go to previous messageGo to next message
_jum
Messages: 508
Registered: February 2008
Senior Member
Your exprsssion:
^[[:alnum:]( .)]*$
matches:
^ start of the string
[ ]* all characters between the outer brackets - zero or more times
[:alnum:] alphanumeric characters
( .) the characters ( . and )
$ end of the string
So it will match (expected or not ?):
select regexp_substr('a.b((cäü 0123  d...fdf() ','^[[:alnum:]( .)]*$') from dual;

Have a look at:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_regexp.htm#sthref547

So I hope You can find out, what to add (or delete) by Yourself.

[Updated on: Fri, 02 October 2009 01:06]

Report message to a moderator

Re: regular expression [message #424476 is a reply to message #424389] Fri, 02 October 2009 10:00 Go to previous message
balji_dxb
Messages: 37
Registered: October 2007
Member
Wow, _jum. your explanation is excellent, i understood more on the regexp now.

Thank you for the same.
Previous Topic: Headings for duplicate columns
Next Topic: Records
Goto Forum:
  


Current Time: Sat Oct 01 07:36:53 CDT 2016

Total time taken to generate the page: 0.07890 seconds