Whoa! Didnt get an email till now that there was replies here. Sorry i havnt posted! Thanks so much for your help guys.
@ircmaxell and others who want to know more, here's a snippet of the file i want to change:
610 //this is the numbers i'd like to replace
01:17:52,672 --> 01:17:57,588 //nothing changes here
So as far as I know, they found Magdas body
after six hours.
611 //and this one needs changing
01:17:57,792 --> 01:18:00,909
There was a farmer who saw the smoke from the fire.
612
01:18:01,112 --> 01:18:04,343
He thought it was a party.
613
01:18:05,872 --> 01:18:09,262
Someone has cut the fat from the body.
614
01:18:11,232 --> 01:18:16,625
Yes, that is true. they found residues
of fat along with the head.
615
01:18:17,952 --> 01:18:20,023
Discusting.
So i cant just do a simple str_replace() because it will also replace some of the timers.
Now i want to take the numbers 610 through 1020 and replace them with numbers starting from 1 through to 410. With the code i wrote i dont get any output. Nothing happens i dont know whats wrong.
I'm using regular expressions because i want to differentiate between the headings and the timers and the only way i seem to do it is to find the line break before the heading. And finding a sequence seems easy with regex.
I want it to look like this
1
01:17:52,672 --> 01:17:57,588
So as far as I know, they found Magdas body
after six hours.
2
01:17:57,792 --> 01:18:00,909
There was a farmer who saw the smoke from the fire.
3
01:18:01,112 --> 01:18:04,343
He thought it was a party.
4
01:18:05,872 --> 01:18:09,262
Someone has cut the fat from the body.
5
01:18:11,232 --> 01:18:16,625
Yes, that is true. they found residues
of fat along with the head.
6
01:18:17,952 --> 01:18:20,023
Discusting.
At all of you who have posted sollutions thank you. I cant test it right now as i have to go somewhere. I'll try them a bit later today. Thanks! I will post results asap!
I am open to all suggestions as to how to aproach this in a different way :)
Thanks again.
And i hope i cleared some things up :)