Read a hard data file

Hi guys,

Ok so I have a text file ( partciulary hard one ) that I need to read and insert datas into a MYSQL DB.

Ok so here is an exemple of the data:

#2500 Buffalo Sabres 3 , Boston Bruins 4 Shots: 22 - 26 BUF PP: 1 of 6 (7 shots), Passing:58/68=85 %, Challenges:29/41=69 % BOS PP: 0 of 5 (6 shots), Passing:74/92=80 %, Challenges:37/44=82 % Attendance: 11157 of 18595 (HSBC Arena) Ticket income: 495371 Match televised: No

Buffalo Sabres scoring.
( G A Sh Hi Ga Ta PIM, +/- Icetime Rating)
R Radim Vrbata 0 0 0 0 0 0 0 -1 6.20 6
R Mike Grier 0 0 0 1 2 0 0 0 18.00 6
R Jason Pominville 0 1 4 0 0 0 0 -1 16.40 8
R Corey Perry 1 0 2 0 2 0 0 0 16.30 7
C Nathan Gerbe 0 0 1 0 1 0 0 -1 6.50 5
C Cody McCormick 0 0 0 1 2 1 5 -1 11.10 5
C Paul Gaustad 1 1 3 3 0 0 4 0 20.40 9
C Tim Connolly 0 1 2 0 2 0 0 0 16.30 6
L Nikita Filatov 0 0 1 0 1 0 0 -1 6.20 5
L Rob Niedermayer 0 0 1 2 0 1 2 0 15.00 8
L Thomas Vanek 0 0 2 1 0 0 0 -1 15.10 7
L Jochen Hecht 1 0 4 0 1 0 0 0 20.30 7
D Craig Rivet 0 0 1 2 0 2 0 0 14.00 7
D Jordan Leopold 0 1 1 3 0 1 0 -2 18.30 8
D Andrej Meszaros 0 0 1 4 0 0 0 0 19.40 8
D Shaone Morrisonn 0 0 1 2 0 2 0 0 18.00 7
D Rostislav Klesla 0 1 1 2 0 0 4 -1 21.00 7
D Derek Morris 0 1 1 2 1 0 0 -1 28.50 7
(GA, A, Sv , PIM, +/- Icetime Rating)
G Ryan Miller 4 0 22 0 0 59.30 5
G Patrick Lalime 0 0 0 0 0 0.00 0

Boston Bruins scoring.
( G A Sh Hi Ga Ta PIM, +/- Icetime Rating)
R Mark Recchi 0 0 1 0 0 0 2 0 14.50 6
R Zach Hamill 0 1 1 0 3 1 0 1 10.50 7
R Nathan Horton 0 1 2 1 0 0 0 1 11.00 7
R Michael Ryder 0 1 1 1 0 0 0 0 19.40 7
C Chris Kelly 0 0 3 0 0 0 0 0 11.10 7
C Patrice Bergeron 1 1 3 3 0 3 2 1 19.30 9
C Tyler Seguin 0 1 0 0 0 0 0 1 11.00 7
C Marc Savard 1 1 4 0 0 0 0 0 20.50 8
C Brad Marchand 0 0 0 1 1 0 2 0 11.10 7
L Rich Peverley 0 0 1 0 1 1 0 1 10.50 6
R Dustin Brown 1 0 3 1 0 1 2 1 16.00 8
L Milan Lucic 1 0 4 3 1 1 5 0 14.40 8
D Adam McQuaid 0 0 0 0 1 1 2 1 14.50 6
D Dennis Seidenberg 0 0 2 0 0 0 0 1 11.30 7
D Thomas Hickey 0 0 1 1 0 0 2 0 18.20 7
D Andrew Ference 0 0 0 0 0 0 0 1 19.10 6
D Tomas Kaberle 0 1 1 0 0 0 0 1 27.30 8
D Zdeno Chara 0 0 3 5 0 4 0 0 26.10 9
(GA, A, Sv , PIM, +/- Icetime Rating)
G Tuukka Rask 3 0 19 0 0 60.00 6
G Tim Thomas 0 0 0 0 0 0.00 0

Three stars of the game:
1st star: Patrice Bergeron
2nd star: Marc Savard
3rd star: Paul Gaustad

Notes for Buffalo Sabres:

Notes for Boston Bruins:

Other notes:
-Milan Lucic beat Cody McCormick in a fight.

#2501
Montreal Canadiens 2 , New Jersey Devils 3
Shots: 27 - 29
MTL PP: 1 of 9 (14 shots), Passing:60/79=75 %, Challenges:29/36=78 %
NJ PP: 1 of 6 (17 shots), Passing:67/93=72 %, Challenges:39/44=86 %
Attendance: 12763 of 21273 (Le Centre Molson)
Ticket income: 390548 Match televised: No

Montreal Canadiens scoring.
( G A Sh Hi Ga Ta PIM, +/- Icetime Rating)
R Aaron Palushaj 0 0 1 1 1 0 0 0 6.50 6
R Lars Eller 0 0 0 0 0 0 0 -1 8.40 6
R Andrei Kostitsyn 1 0 5 0 0 0 0 -1 20.40 7
R Brian Gionta 0 1 2 0 1 0 0 1 15.00 7
C Nazem Kadri 0 0 0 0 0 0 0 0 6.50 6
C Jirí Tlustý 0 0 0 0 0 0 0 -1 8.40 6
C Mikhail Grabovski 0 0 2 0 0 0 0 -1 16.50 7
C Tomas Plekanec 1 0 5 0 1 0 0 1 21.30 7
L Max Pacioretty 0 0 0 0 1 0 2 0 6.50 5
L Travis Moen 0 0 2 0 0 1 4 -1 16.10 6
L Cory Stillman 0 0 3 0 0 0 0 0 21.00 7
L Mike Cammalleri 0 1 2 1 1 0 0 0 20.20 7
D Jarred Tinordi 0 0 0 1 0 1 0 -1 8.40 6
D P.K. Subban 0 0 2 2 1 0 2 -1 28.30 7
D Roman Hamrlik 0 0 0 4 0 1 4 1 22.50 7
D Yannick Weber 0 0 2 0 0 0 0 -1 13.00 6
D Hal Gill 0 0 0 0 1 1 0 0 20.50 6
D Andrei Markov 0 1 4 1 0 1 0 0 26.10 7
(GA, A, Sv , PIM, +/- Icetime Rating)
G Carey Price 3 0 26 0 0 59.20 7
G Alex Auld 0 0 0 0 0 0.00 0

New Jersey Devils scoring.
( G A Sh Hi Ga Ta PIM, +/- Icetime Rating)
R Vladimir Zharkov 0 1 0 0 0 0 0 0 6.20 6
R Adam Mair 0 0 1 1 1 0 0 -1 7.40 6
R David Clarkson 0 1 2 2 0 0 10 1 13.00 8
R Dainius Zubrus 1 1 4 1 0 0 0 1 19.50 8
C Jacob Josefson 0 1 0 0 0 0 0 0 6.20 6
C David Steckel 0 0 2 0 0 0 0 -1 9.50 6
C Rod Pelley 1 0 2 3 0 0 0 2 22.50 8
C Travis Zajac 1 0 5 1 0 0 4 0 23.00 7
L Alexander Semin 0 0 3 0 1 0 0 0 8.10 7
L Brian Rolston 0 0 0 0 0 1 0 -1 11.00 5
L Ilya Kovalchuk 0 0 3 0 0 0 2 0 16.40 7
L Patrik Elias 0 1 3 0 1 0 2 2 19.00 8
D Rob Davison 0 0 0 0 0 0 0 -1 6.00 5
D Bryce Salvador 0 0 2 0 1 0 0 0 15.00 6
D Andy Greene 0 0 3 0 0 0 0 2 25.40 7
D Henrik Tallinder 0 0 1 0 0 2 0 -1 17.30 6
D Colin White 0 0 1 0 0 1 0 0 27.00 9
D Anton Volchenkov 0 0 0 3 0 3 0 2 28.50 8
(GA, A, Sv , PIM, +/- Icetime Rating)
G Martin Brodeur 2 0 25 0 0 60.00 9
G Johan Hedberg 0 0 0 0 0 0.00 0

Three stars of the game:
1st star: Dainius Zubrus
2nd star: Martin Brodeur
3rd star: David Clarkson

Notes for Montreal Canadiens:

Notes for New Jersey Devils:

Other notes:

Ok so what I wan to do is read each line and each data and set it to the DB.
Some clarification. There is always 20 ( goalies included ) players in the Rosters section. Dont need to split when there is a line of text, exemple: “Montreal Canadiens scoring.”

But I need to split everything else.

Also, some of the reports have additional info:

### #913 Pittsburgh Penguins 4 , New York Islanders 3 (SO) Shots: 30 - 27 PIT PP: 0 of 2 (4 shots), Passing:83/92=90 %, Challenges:32/52=60 % NYI PP: 2 of 3 (8 shots), Passing:73/99=73 %, Challenges:30/41=71 % Attendance: 10768 of 16958 (Mellon Arena) Ticket income: 512556 Match televised: No

Pittsburgh Penguins scoring.
( G A Sh Hi Ga Ta PIM, +/- Icetime Rating)
L Matt Bradley 0 0 1 1 2 1 0 0 10.10 6
R Reynaldo Bernitz 1 0 3 0 0 0 2 1 15.10 7
R Evgeny Grachev 1 0 3 1 0 0 0 1 19.10 9
R Mattias Tedenby 0 1 2 2 2 0 0 1 21.20 7
C Tyler Kennedy 0 0 1 0 0 0 0 0 11.00 6
C Chris Kunitz 0 1 4 0 0 0 0 2 13.20 7
C Jaden Schwartz 0 0 2 0 1 0 0 1 18.20 7
C Sean Couturier 0 0 3 1 3 1 0 0 23.10 6
L Lee Stempniak 0 0 1 0 1 0 2 0 8.00 6
L Sergei Sharifyanov 1 0 3 0 3 0 0 1 15.30 6
L Mikael Backlund 0 0 1 1 0 0 0 1 19.10 5
L Evander Kane 0 0 4 0 2 0 2 0 22.50 7
D Brian Strait 0 2 1 1 0 1 0 1 13.00 7
D Kevin Bieksa 0 0 1 1 1 1 0 0 20.20 5
D Brooks Orpik 0 0 0 3 4 1 0 0 27.00 6
D Willie Mitchell 0 2 0 1 0 0 0 1 15.20 7
D Braydon Coburn 0 0 1 3 1 3 0 0 19.00 7
D Brent Seabrook 0 0 1 3 0 3 0 0 30.10 8
(GA, A, Sv , PIM, +/- Icetime Rating)
G Chet Pickard 3 0 24 0 0 65.00 7
G Brent Johnson 0 0 0 0 0 0.00 0

New York Islanders scoring.
( G A Sh Hi Ga Ta PIM, +/- Icetime Rating)
R Kirill Kabanov 0 0 1 0 0 0 0 -2 9.10 4
R Ted Purcell 0 0 0 1 1 2 0 0 16.50 4
R Mike Cammalleri 0 1 0 0 0 0 2 1 14.40 5
R Jiri Hudler 0 1 4 0 3 0 0 0 20.10 5
C Rory Glin 0 0 1 0 0 0 2 -2 9.10 4
C John Mitchell 0 1 1 0 0 2 0 0 16.30 6
C James Wright 1 0 1 2 1 0 0 1 18.40 6
C Frans Nielsen 0 1 4 2 1 0 0 0 20.10 6
L Shawn Thornton 0 0 2 1 2 1 0 -3 9.50 4
L Kristian Huselius 1 0 1 1 1 1 0 0 18.00 6
L Trent Hunter 0 1 2 0 1 0 0 0 15.20 7
L Ilya Kovalchuk 0 0 5 6 0 7 0 0 22.40 10
D Travis Hamonic 0 0 3 1 0 4 0 -1 21.20 6
D Mark Eaton 0 0 1 0 0 0 0 0 16.10 5
D Anton Volchenkov 0 0 2 2 0 1 0 -1 26.20 7
D Andrew MacDonald 0 1 0 0 0 1 0 0 21.00 6
D Mike Lundin 0 0 2 4 0 0 0 0 17.40 7
D James Wisniewski 1 0 4 2 1 1 0 -2 27.50 6
(GA, A, Sv , PIM, +/- Icetime Rating)
G Rick DiPietro 3 0 27 0 0 65.00 8
G Mikko Koskinen 0 0 0 0 0 0.00 0

Three stars of the game:
1st star: Reynaldo Bernitz
2nd star: Evgeny Grachev
3rd star: Sergei Sharifyanov

Notes for Pittsburgh Penguins:
-Sergei Sharifyanov scored his 10th goal of the season.
-Willie Mitchell notched his 10th assist of the season.

Notes for New York Islanders:
-James Wright ended his 6 game point drought.
-James Wisniewski finally ended his 13 game goal drought.

Other notes:

Farm game result:
Wilkes-Barre Penguins 5( 16) , Bridgeport Sound Tigers 3( 16)

0-1 BRG Pat Dwyer (Reid Cashman, Chris Conner)
1-1 WIL Viktor Ekbom (Joe Vitale, Nick Petersen)
2-1 WIL Carl Sneep (Trevor Lewis)
2-2 BRG Kirill Petrov (Anders Lee)
3-2 WIL Kenndal McArdle (Trevor Lewis)
4-2 WIL Robert Bortuzzo (Nick Petersen)
4-3 BRG Anders Lee (Jannik Hansen)
5-3 WIL Sergei Anshakov (Josh Birkholz)

Goalies: Marek Schwarz - Kevin Poulin

The section Farm team is not always the same. Something it can be 10 rows, sometimes 3.
For this, I dont mind having everything split in lines.
Ex:
Line 1: Farm game result:
Line 2: Wilkes-Barre Penguins 5( 16) , Bridgeport Sound Tigers 3( 16)

Line 4: 0-1 BRG Pat Dwyer (Reid Cashman, Chris Conner)

Thank you for your help and time,
Ara

Sponsor our Newsletter | Privacy Policy | Terms of Service