Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Regular Expressions (Oracle 10g, R2, Linux)
Regular Expressions [message #381011] Wed, 14 January 2009 15:25 Go to next message
greendba
Messages: 22
Registered: September 2008
Location: Toronto
Junior Member
I need help with regular expressions:
I need to accept either 0 or negative values and no decimals
The following expression works perfect in a RegEx tester I have, but not in Oracle (Actually it is APEX... so maybe this is in the wrong forum)

Expression = (^([-])([1-9]{1}[0-9]{1})$)|(^[0]$)

So Why doesn't this work in Oracle?
This is attached to a validation in APEX... A Similar validation in PL/SQL works fine, but using the above expression doesn't reject any values.

Thanks
Eric
Re: Regular Expressions [message #381937 is a reply to message #381011] Tue, 20 January 2009 06:26 Go to previous messageGo to next message
c_stenersen
Messages: 255
Registered: August 2007
Senior Member
The error in your expression (provided that your description of what you need is correct) is that you will only match two-digit numbers (you give in {1} after both your number expressions) or zero. The syntax is correct, and you will get a match if the number is negative, and it has two digits

Try this regular expression:
'(^[-][1-9]+[\d]*$)|(^0$)'

Matches:
a minus sign
characters 1 to 9, one or more times (a + indicates that one or more hits are allowed)
a digit, 0 or more times (a * indicates that zero or more hits are allowed)
or just a zero.

A null value will not match the expression.
Re: Regular Expressions [message #382053 is a reply to message #381937] Tue, 20 January 2009 14:59 Go to previous messageGo to next message
greendba
Messages: 22
Registered: September 2008
Location: Toronto
Junior Member
Unfortunately... This expression doesn't work either.
It must be APEX related... It may not be processing the validation for some reason.

I'll re-post in the APEX form and see if there any tips.

Thank you for the input though!

Cheers!

Eric
Re: Regular Expressions [message #382059 is a reply to message #382053] Tue, 20 January 2009 15:42 Go to previous message
c_stenersen
Messages: 255
Registered: August 2007
Senior Member
Try using the debug functionality to see if the validation is run at all. If not, check the condition defined for it.
Previous Topic: Reg. unload as text in oracle apex 3.1
Next Topic: Data Conversion and Conversion Process Flow (merged 2 by LF and 4 by MC)
Goto Forum:
  


Current Time: Thu Dec 08 22:19:45 CST 2016

Total time taken to generate the page: 0.09703 seconds