preg replace - With PHP how do you output a textfile into a table along with links -


I have this text file:

  December 20:15 Naruto December 123 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 content to the table Tiles and chapters in the date and time in your column and in the second

In addition .. I need to replace the title and chapter with a link which should be formatted in this form:

  & lt; A href = "/ title / headline chapter" & gt; Headline Chapter & lt; / A & gt;  

The text file contains the headings for clarification:

  Naruto Naruto De Gray Man bleach 50 x 50  

More chapters are numbers which are the following:

  123 98 001 128 44  

  1. Read the file and store each row in an array.
  2. & lt; Open table & gt tag
  3. Remove the date / time / title / chapter using the loop and regex through the array.

To get started here is regex - you should modify it slightly to meet your needs:

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

For each item in the array, the appropriate & lt; Tr & gt; & amp; Write; Filled with extracted data & lt; Td> tag.

Update:

  & lt ;? Php $ filedata = "December 20:15 Naruto December 123 04 17:42 Naruto 98 December 04 16:19 De Gray Man 001 December 04 16:05 Bleach 128 December 04 12:13 50 x 50 44"; $ Rows = explosion ("\ n", $ claimant); Echo "& lt; table border = \" 1 \ "& gt;"; Forex currency ($ lines as line $) {echo "<"> <;;; & lt; tr & gt;;; Preg_match ("/ ^ ([a-zA-Z] {3} \ s \ d {2} \ s \ d {2}:.? \ D {2}) \ s (+) \ s (\ d + ) \ S *? $ / ", $ Line, $ matches); Echo "& lt; td & gt; $ matches [1] & lt; / td & gt;"; "Matches" [2] / $ matches [2] $ matches [3] \ "$ matches [2] $ matches [3] & amp; nbsp; & amp; nbsp; Lt; / a & gt; & lt; / td & gt; "; Echo "& lt; / tr & gt;"; } Resonates "& lt; / table & gt;" ? & Gt;  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -