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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:29:07+00:00 2026-05-18T09:29:07+00:00

I need your kind help to resolve this question. I state that I am

  • 0

I need your kind help to resolve this question.

I state that I am not able to use regolar expressions with Oracle PL/SQL, but I promise that I’ll study them ASAP!

Please suppose you have a table with a column called MY_COLUMN of type VARCHAR2(4000).

This colums is populated as follows:

Description of first no.;00123457;Description of 2nd number;91399399119;Third Descr.;13456

You can see that the strings are composed by couple of numbers (which may begin with zero), and strings (containing all alphanumeric characters, and also dot, ‘, /, \, and so on):

Description1;Number1;Description2;Number2;Description3;Number3;......;DescriptionN;NumberN

Of course, N is not known, this means that the number of couples for every record can vary from record to record.

In every couple the first element is always the number (which may begin with zero, I repeat), and the second element is the string.

The field separator is ALWAYS semicolon (;).

I would like to transform the numbers as follows:

00123457 ===> 001-23457
91399399119 ===> 913-99399119
13456 ===> 134-56

This means, after the first three digits of the number, I need to put a dash “-“

How can I achieve this using regular expressions?

Thank you in advance for your kind cooperation!

  • 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-18T09:29:08+00:00Added an answer on May 18, 2026 at 9:29 am

    I don’t know Oracle/PL/SQL, but I can provide a regex:

    ([[:digit:]]{3})([[:digit:]]+)
    

    matches a number of at least four digits and remembers the first three separately from the rest.

    RegexBuddy constructs the following code snippet from this:

    DECLARE
        result VARCHAR2(255);
    BEGIN
        result := REGEXP_REPLACE(subject, '([[:digit:]]{3})([[:digit:]]+)', '\1-\2', 1, 0, 'c');
    END;
    

    If you need to make sure that those numbers are always directly surrounded by ;, you can alter this slightly:

    (^|;)([[:digit:]]{3})([[:digit:]]+)(;|$)
    

    However, this will not work if two numbers can directly follow each other (12345;67890 will only match the first number). If that’s not a problem, use

    result := REGEXP_REPLACE(subject, '(^|;)([[:digit:]]{3})([[:digit:]]+)(;|$)', '\1\2-\3\4', 1, 0, 'c');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Do you need to use some kind of provider? Can you setup your own
I need your expertise once again. I have a java class that searches a
I need your help, For example I have a decimal type variable and I
I need your help to define a special case in XML schema: A sequence
I really need your help in my issue very quickly and it's too close
I've some questions .. and I really need your help. I have an application.
I need some resources that talk about how to design your software to be
I need your qualified help! I'm programing in C++, using a PIC 18F87J50 and
hy guys, i really need your help. i've succesfully connected to ftp server via
.NET developers out there! Need your opinion here! I am now using Visual Assist

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.