http://www.perlmonks.org?node_id=168433


in reply to Two-dimensional match/regex?

You're best of with an array of lines here, I think. Try to match the first regex against each line in succession, if it does use pos with substr and regex with a ^ anchor for the following line(s).

Makeshifts last the longest.