I have a huge text file that contains some data that I want to insert in my database. The problem is that I don't want to insert every data, and I can't seem to make any preg_match_all(), in fact I'm a little newbie with regular expressions:
file.txt
[03-07-2010 09:03:23] : [180.20.106.107] : [/success]:
[SEND] invite -> helen,
[SEND] uname -> test,
[SEND] fname -> test,
[03-07-2010 09:04:28] : [180.20.106.107] : [/success]:
[SEND] invite -> helen3,
[SEND] uname -> test3,
[SEND] fname -> test3,
[SEND] register -> register,
[03-07-2010 09:07:43] : [180.20.106.107] : [/success]:
[SEND] invite -> register,
[SEND] uname -> helen2,
[SEND] fname -> none,
[03-07-2010 09:09:48] : [180.20.106.107] : [/success]:
[SEND] invite -> helen2,
[SEND] uname -> test2,
[SEND] fname -> test2,
[03-07-2010 10:14:18] : [180.20.106.107] : [/success]:
[SEND] invite -> register,
[SEND] uname -> mickey,
[SEND] fname -> test8,
[SEND] register -> register,
I want to extract only the block that has register, that means from the start [03-07-2010 09:04:28] till the end register -> register, and [03-07-2010 10:14:18] to the end of that block (register -> register).
I have tried a lot of things, but like I said, I'm a newbie in regex
This does not work:
#\[(.*)\] : \[(.*)\] : \[\/success\]:(.*)register -> register#s