Skip to Main Content
  • Questions
  • Website validation using regexp_like.



Connor and Chris don't just spend all day on AskTOM. You can also catch regular content via Connor's blog and Chris's blog. Or if video is more your thing, check out Connor's latest video and Chris's latest video from their Youtube channels. And of course, keep up to date with AskTOM via the official twitter account.

Question and Answer

Chris Saxon

Thanks for the question, Nikhil.

Asked: July 07, 2016 - 11:50 am UTC

Answered by: Chris Saxon - Last updated: July 07, 2016 - 1:15 pm UTC

Category: Developer - Version: 11g

Viewed 1000+ times

Whilst you are here, check out some content from the AskTom team: RTFM? KISS? Comment? Whatever, just get the code to work right!

You Asked


Could you please help to get website validation query using regexp_like.

https// both should get validated.

Thanks in advance.

and we said...

The following regex will validate the top-level domain and whether it has http(s):// or not:

Plug it to regexp_like and you get:
with urls as (
  select '' u from dual union all
  select '' u from dual union all
  select '' u from dual union all
  select '' u from dual union all
 select '' u from dual union all
  select 'not an URL' u from dual union all
  select 'http://' u from dual 
  select * from urls
  where  regexp_like(u, '^(http(s)*://)*[a-z0-9.-]+$');


But this is basic. It only checks the top-level domain. Checking that a string is a valid URL is complicated:

Unless there's a pressing need to ensure that these are real URLs, writing a regular expression is probably more hassle than it's worth.

and you rated our response

  (1 rating)

Is this answer out of date? If it is, please let us know via a Review


July 07, 2016 - 1:24 pm UTC

Reviewer: A reader

Thanks a lot Chris!!