What is the difference between LIKE clause of oracle and using regexp?

What is the difference between LIKE clause of oracle and using  regexp?
Nusrat NuriyevAsked:
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.

Terry WoodsIT GuruCommented:
I can't give details on the complexities of how it will affect performance, but regular expressions (using REGEXP_LIKE) allow for much more complicated patterns than what LIKE does. Some details on what can be used in a REGEXP_LIKE pattern are here.

For example, a regular expression can match a letter from a to m, followed by 3 or 4 numbers between 2 and 7:
[a-m][2-7]{3,4}

Open in new window

This could not be done with a single use of LIKE.
0

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
slightwv (䄆 Netminder) Commented:
Agree with the above post.  LIKE only uses wildcard operators, '%' and '_'.  Regular expressions are EXTREMLY powerful and can match just about anything you can dream up.

Of course, that comes with a price.  Regular expression operations can be very expensive.

LIKE can also use an index if there are no left sided wildcards.
0
sdstuberCommented:
as noted above, you can do more with regular expressions

however, regexp operations are expensive (in terms of cpu and time) and can not, by default, be indexed.

LIKE clauses on leading values can be indexed - for example   my_column like 'ABC%'  can use an index but
my_column LIKE '%ABC' can not
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.