Now, I only need to add the function of process that will parse each block within the while loop rigth?

I'd like to parse each block using regex.
What parsing of the block do you require?