Oracle RegExp to Find String

Posted on 2011-04-26
Last Modified: 2012-05-11

I am looking for a regexp in Oracle sql to find the following conditions.


The middle character is a - (dash). Basically I want any rows that have a dash with a character, including space, next to the dash on either side.

Thank you,

Question by:bobcaputo
    LVL 73

    Expert Comment

    select * from yourtable
    where regexp_like(yourstring,'[^-]-[^-] ')

    this will find any dash surrounded by non-dashes
    LVL 73

    Accepted Solution

    if you specifically want to find space and non-space characters surrounding a dash

    select * from yourtable
    where regexp_like(yourstring,'[^ -]- | -[^ -] ')

    this will find dashes with a space on one side
    and a non-space-non-dash on the other side

    Author Comment

    Thank you, now that I see it, it is much clearer and obvious!!!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Article by: Swadhin
    From the Oracle SQL Reference ( we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
    Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
    This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
    This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now