Pattern recognition in a text field

I am doing some data profiling and want to create a procedure which will provide back the pattern of the data in the text field.  In my first case, this is phone number.  So, for each phone number in a table I have data in, I want to parse through the data element and return the pattern.  For example, if the field was a phone number, I would expect patterns consisting of Numbers (N), Characters (A) and special or delimiting characters.  If I were to pass in data that looked like this:  (123) 234-3456, the return pattern would need to be (NNN) NNN-NNNN.  If the phone looked like this 123.L16.1234, then the return pattern would need to look like this NNN.NNN.NNNN.  I am thinking that the solution will including using regular expressions from Oracle, but I just can't wrap my head around the best way to do this.  Any help would be appreciated.  Thanks!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SujithData ArchitectCommented:
select replace(regexp_replace(regexp_replace(<your column>, '[0-9]', '~'), '[a-zA-Z]', 'A'), '~', 'N') pattern
from <table>;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RobinBuchananAuthor Commented:
Thank you!  Very quick response, allows me to proceed with my analysis today!
SujithData ArchitectCommented:
It was a bit too quick and a bit longer.

Use this version instead.
select regexp_replace(regexp_replace(<your column>, '[a-zA-Z]', 'A') , '[0-9]', 'N') pattern
from <your table>;

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.