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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:49:54+00:00 2026-05-13T00:49:54+00:00

I have this text file: Dec 04 20:15 Naruto 123 Dec 04 17:42 Naruto

  • 0

I have this text file:

Dec 04 20:15 Naruto 123
Dec 04 17:42 Naruto 98
Dec 04 16:19 D Gray Man 001
Dec 04 16:05 Bleach 128
Dec 04 12:13 50 x 50 44

I need to output the contents into a table with the Date and Time in its own column and the Tile and Chapter in another.

Also.. I need to replace the Title and Chapter with a link that must be formatted this way:

<a href="/title/title chapter">title chapter</a>

For clarification the titles in the text file are:

Naruto
Naruto
D Gray Man
Bleach
50 x 50

And the chapters are the numbers that follow:

123
98
001
128
44
  • 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-13T00:49:54+00:00Added an answer on May 13, 2026 at 12:49 am
    1. Read the file and store each line into an array.
    2. Open <table> tag
    3. Loop through the array and extract the date/time/title/chapter using regex.

    Here is the regex to start with – you might want to modify it a little to meet your needs:

    /^([a-zA-Z]{3}\s\d{2})\s(\d{2}:\d{2})\s(.+?)\s(\d+)\s*?$/
    //$1 contains date : "Dec 04"
    //$2 contains time : "20:15"
    //$3 contains the title : "Naruto"
    //$4 contains the chapter : "123"
    

    For each item in the array, write appropriate <tr> & <td> tags filled with the extracted data.

    Update:

    <?php
    $filedata = "Dec 04 20:15 Naruto 123
    Dec 04 17:42 Naruto 98
    Dec 04 16:19 D Gray Man 001
    Dec 04 16:05 Bleach 128
    Dec 04 12:13 50 x 50 44";
    
    $lines = explode("\n", $filedata);
    
    echo "<table border=\"1\">";
    
    foreach($lines as $line)
    {
        echo "<tr>";
        preg_match("/^([a-zA-Z]{3}\s\d{2}\s\d{2}:\d{2})\s(.+?)\s(\d+)\s*?$/", $line, $matches);
        echo "<td>$matches[1]</td>";
        echo "<td><a href=\"/$matches[2]/$matches[2] $matches[3]\">$matches[2] $matches[3]</a></td>";
        echo "</tr>";
    }
    echo "</table>"
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have text file with some text information and i need to split this
I have a text file.I need to get data from this text file and
I have this text file and I need certain parts of it to be
I have an autofill search that reads the contents of a text file (this
I have got this text file with latitude and longitude values of different points
I have a text file exported from a Foxpro (Dos-based) program, but this text
I have this code in PHP writing views to a text-file and just increasing
I have a text file like this: A B C And each element has
I have a text file that looks like this. A 102 B 456 C
I have this xml file which has text init. i.e Hi my name is

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.