Capture line numbers in pattern objects