Here's the actual data I want it to show: block 1 - 601-751 block 2 - 1627-1688 block 3 - 4601-7859 But the PHP finds the start of a block by PREG_OFFSET_CAPTURE, and the end of a block by the code you wrote for me, and it comes out like this: Square bracket'ed block 1 - 600-753 Square bracket'ed block 2 - 1628-1692 Square bracket'ed block 3 - 4604-7865