Skip to Main Content

APEX

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!

Phone Number - Regular Expression

4610Dec 13 2007 — edited Dec 13 2007
I'm trying to validate a phone number using regular expressions.

My validation appears as the following:

IF REGEXP_LIKE ( :P10_PHONE, '^\(?[[:digit:]]{3}\)?[-. ]?[[:digit:]]{3}[-. ]?[[:digit:]]{4}$' ) THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;

The problem I noticed is that it returned true even if I typed in a phone number like this:

(555 123-4567

Is there a way to tell it that if one parenthesis is there that the other one should be there as well? Or should I just do an instr if the regexp_like returns true and double-check it myself?

Thanks,
Chad
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 10 2008
Added on Dec 13 2007
2 comments
1,079 views