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 9146731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:49:00+00:00 2026-06-17T10:49:00+00:00

I have a table that contains a VARCHAR2 column called COMMANDS. The data in

  • 0

I have a table that contains a VARCHAR2 column called COMMANDS.

The data in this column is a bunch of difficult to read ZPL code that will be sent to a label printer, and amidst the ZPL there are several tokens in the form {TABLE.COLUMN}.

I would a like nice list of all the distinct {TABLE.COLUMN} tokens that are found in COMMANDS. I wrote the following regex to match the token format:

SELECT REGEXP_SUBSTR(COMMANDS,'\{\w+\.\w+\}') FROM MYTABLE;

The regex works, but it only returns the first matched token per row. Is there a way to return all regex matches for each row?

I’m using Oracle 11GR2.

Edit – Here is a small sample of data from a single row — there are many such lines in each row:

^FO360,065^AEN,25,10^FD{CUSTOMERS.CUST_NAME}^FS
^FO360,095^AAN,15,12^FD{CUSTOMERS.CUST_ADDR1}^FS

So if that was the only row in table, I’d like to have returned:

{CUSTOMERS.CUST_NAME}
{CUSTOMERS.CUST_ADDR1}
  • 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-06-17T10:49:02+00:00Added an answer on June 17, 2026 at 10:49 am

    You’ve provided sample of data saying that this is a single row but have presented it as two different rows. So this example based on your words.

     -- Sample of data from your question + extra row for the sake of demonstration
     -- id column is added to distinguish the rows(I assume you have one)
      with t1(id, col) as( 
        select 1, '^FO360,065^AEN,25,10^FD{CUSTOMERS1.CUST_NAME}^FS^FO360,095^AAN,15,12^FD{CUSTOMERS1.CUST_ADDR1}^FS' from dual union all
        select 2, '^FO360,065^AEN,25,10^FD{CUSTOMERS2.CUST_NAME}^FS^FO360,095^AAN,15,12^FD{CUSTOMERS2.CUST_ADDR2}^FS' from dual
      ),
      cnt(c) as(
        select level
          from (select max(regexp_count(col, '{\w+.\w+}')) as o_c
                  from t1
                ) z
         connect by level <= z.o_c
      )
      select t1.id, listagg(regexp_substr(t1.col, '{\w+.\w+}', 1, cnt.c)) within group(order by t1.id) res
        from t1
       cross join cnt
       group by t1.id
    

    Result:

        ID   RES
        ---------------------------------------------------------
         1   {CUSTOMERS1.CUST_ADDR1}{CUSTOMERS1.CUST_NAME}
         2   {CUSTOMERS2.CUST_ADDR2}{CUSTOMERS2.CUST_NAME}
    

    As per @a_horse_with_no_name comment to the question, really, it’s much simpler to just replace everything else that doesn’t match the pattern. Here is an example:

     with t1(col) as(
        select '^FO360,065^AEN,25,10^FD{CUSTOMERS.CUST_NAME}^FS^FO360,095^AAN,15,12^FD{CUSTOMERS.CUST_ADDR1}^FS' from dual
     )
     select regexp_replace(t1.col, '({\w+.\w+})|.', '\1') res
      from t1
    

    Result:

    RES
    -------------------------------------------
    {CUSTOMERS.CUST_NAME}{CUSTOMERS.CUST_ADDR1} 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that contains a column that is XML data type. I
I have a varchar(100) column in a table that contains a mix of integers
I have a table that contains all the data about users . Users can
I have a table that contains an Id column as a primary key. There
I have a table that contains a Date column in varchar format. The date
I have a table that contains several thousand rows, having a Varchar column that
I have a table with a column named Description that contains XML like: <Parent>
I have a table structure that contains a identifier column and a column that
I have a table that contains a varchar column that allows null or empty
We have a very large historical table that contains a column with at most

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.