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

  • Home
  • SEARCH
  • 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 9312099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:32:42+00:00 2026-06-19T01:32:42+00:00

Ok, so here’s the thing. I have note in an old sql server text

  • 0

Ok, so here’s the thing. I have note in an old sql server text format. It puts all notes for a record in one big blob of data. I need to take that blob of text and parse it out to create one row for each note entry with separate columns for timestamp, user, and note text. The only way do do this that I can think of is to use regex to locate the unix timestamp for each note and parse on that. I know that there is the split function for parsing on delimiters, but that removes the delimiter. I need to parse on \d{10} but also retain the 10 digit number. Here is some sample data.

create table test_table
(
job_number number,
notes varchar2(4000)
)

insert into test_table values
(12345, '1234567890 username notes text notes text notes text notes text 5468204562 username notes text notes text notes text notes text 1025478510 username notes text notes text notes text notes text')
(12346, '2345678901 username notes text notes text notes text notes text 1523024512 username notes text notes text notes text notes text 1578451236 username notes text notes text notes text notes text')
(12347, '2345678902 username notes text notes text notes text notes text 2365201214 username notes text notes text notes text notes text 1202154215 username notes text notes text notes text notes text')

I would like to see one record for each note to look like this.

JOB_NUMBER        DTTM    USER     NOTES_TEXT
----------    ----------  ----     ----------
12345         1234567890  USERNAME notes text notes text notes text notes text
12345         5468204562  USERNAME notes text notes text notes text notes text
12345         1025478510  USERNAME notes text notes text notes text notes text
12346         2345678901  USERNAME notes text notes text notes text notes text
12346         1523024512  USERNAME notes text notes text notes text notes text
12346         1578451236  USERNAME notes text notes text notes text notes text
12347         2345678902  USERNAME notes text notes text notes text notes text
12347         2365201214  USERNAME notes text notes text notes text notes text
12347         1202154215  USERNAME notes text notes text notes text notes text

Thank you for any help you can provide

  • 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-19T01:32:43+00:00Added an answer on June 19, 2026 at 1:32 am

    Text::ParseWords can handle the quoted strings and split on comma. You can skip ahead in the input by using the flip-flop operator 1 .. /values/. This particular skip method may need to be revised.

    Then it is just a matter of parsing the strings, which can be done by splitting using a lookahead assertion and then capturing the various entries in each substring. The regex in the split:

    my @entries = split /(?<!^)(?=\d{10})/, $data;
    

    has a negative lookbehind assertion to avoid matching at the start of the string ^, and a lookahead assertion to match 10 numbers. This will effectively split at the numbers and keep them.

    The DATA file handle is used for demonstration, simply replace <DATA> with <> to use with argument file name.

    use strict;
    use warnings;
    use Text::ParseWords;
    
    my $format = "%-12s %-12s %-10s %s\n";              # format for printing
    my @headers = qw(JOB_NUMBER DTTM USER NOTES_TEXT);  
    printf $format, @headers;
    printf $format, map "-" x length, @headers;         # print underline
    while (<DATA>) {
        next while 1 .. /values/;                       # skip to data
        s/^\(|\)$//g;                                   # remove parentheses
        my ($job, $data) = quotewords('\s*,\s*',0, $_); # parse string
        my @entries = split /(?<!^)(?=\d{10})/, $data;  # split into entries
        for my $entry (@entries) {                      # parse each entry
            my ($dttm, $user, $notes) = $entry =~ /^(\d+)\s+(\S+)\s+(.*)/;
            printf $format, $job, $dttm, $user, $entry;
        }
    }
    
    __DATA__
    create table test_table
    (
    job_number number,
    notes varchar2(4000)
    )
    
    insert into test_table values
    (12345, '1234567890 username notes text notes text notes text notes text 5468204562 username notes text notes text notes text notes text 1025478510 username notes text notes text notes text notes text')
    (12346, '2345678901 username notes text notes text notes text notes text 1523024512 username notes text notes text notes text notes text 1578451236 username notes text notes text notes text notes text')
    (12347, '2345678902 username notes text notes text notes text notes text 2365201214 username notes text notes text notes text notes text 1202154215 username notes text notes text notes text notes text')
    

    Output:

    JOB_NUMBER   DTTM         USER       NOTES_TEXT
    ----------   ----         ----       ----------
    12345        1234567890   username   1234567890 username notes text notes text notes text notes text
    12345        5468204562   username   5468204562 username notes text notes text notes text notes text
    12345        1025478510   username   1025478510 username notes text notes text notes text notes text
    12346        2345678901   username   2345678901 username notes text notes text notes text notes text
    12346        1523024512   username   1523024512 username notes text notes text notes text notes text
    12346        1578451236   username   1578451236 username notes text notes text notes text notes text
    12347        2345678902   username   2345678902 username notes text notes text notes text notes text
    12347        2365201214   username   2365201214 username notes text notes text notes text notes text
    12347        1202154215   username   1202154215 username notes text notes text notes text notes text
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here is the script I'm using, copied directly from Google: <script type=text/javascript> var _gaq
Here is my SQL script CREATE TABLE tracks( track_id int NOT NULL AUTO_INCREMENT, account_id
Here's my problem I have this javascript if (exchRate != ) { function roundthecon()
Here is what I want to do. Use this HTML line and have the
Here's the setup - I have a view that lists products. On that same
Here's my situation. I have a DotNetNuke application. I want to link to an
Here is a scenario: User installs .NET application that you have made. After some
Here is my problem: I have a chatapplication and the messages are displayed in
Here is my code for the POST request to the server. The JSON to

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.