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


in reply to Two-dimensional match/regex?

As far as I know, the best algorithm for doing exact two-dimensional matching is still the one that was published in 1993 by Ricardo Baeza-Yates and Mireille Régnier. You can download their paper about it.

I don't know much about two-dimensional regular expressions, but this looks like a good place to start researching the subject if you're interested.