Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6680033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:25:40+00:00 2026-05-26T04:25:40+00:00

I got this query and want to extract the value between the brackets. select

  • 0

I got this query and want to extract the value between the brackets.

select de_desc, regexp_substr(de_desc, '\[(.+)\]', 1)
from DATABASE
where col_name like '[%]';

It however gives me the value with the brackets such as “[TEST]”. I just want “TEST”. How do I modify the query to get it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:25:41+00:00Added an answer on May 26, 2026 at 4:25 am

    The third parameter of the REGEXP_SUBSTR function indicates the position in the target string (de_desc in your example) where you want to start searching. Assuming a match is found in the given portion of the string, it doesn’t affect what is returned.

    In Oracle 11g, there is a sixth parameter to the function, that I think is what you are trying to use, which indicates the capture group that you want returned. An example of proper use would be:

    SELECT regexp_substr('abc[def]ghi', '\[(.+)\]', 1,1,NULL,1) from dual;
    

    Where the last parameter 1 indicate the number of the capture group you want returned. Here is a link to the documentation that describes the parameter.

    10g does not appear to have this option, but in your case you can achieve the same result with:

    select substr( match, 2, length(match)-2 ) from (
    SELECT regexp_substr('abc[def]ghi', '\[(.+)\]') match FROM dual
    );
    

    since you know that a match will have exactly one excess character at the beginning and end. (Alternatively, you could use RTRIM and LTRIM to remove brackets from both ends of the result.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a mysql query like this: SELECT A.ID, A.NAME, B.ID, B.NAME FROM table1
i got this SQL query where post_title taken from $_GET $sql = SELECT ID
Right, so I've got a query that looks like this: $bestof_query = SELECT *
I've got a query that looks a bit like this: select records.id, contacts.name +
I do this query(1): (1)SELECT * FROM t1 WHERE title LIKE 'key%' LIMIT 1
I got a problem with this linq query: from PersistedFileInfo fi in m_Database from
I've got an SQL query that looks like this: INSERT INTO DB..incident ( incident_number
When I run the sql query I got something like this : Disallowed implicit
I have this query: SELECT Stops_edited_small1.AtcoCode, ABC.Naptan_Atco, ABC.Stop_Code FROM Stops_edited_small1 INNER JOIN ABC ON
I have this query: select top(2) property_id_ref ,image_file ,property_name from property_master a inner join

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.