From: Charles D Hixson Date: 2002-03-10T07:17:06+09:00 Subject: 2-dimensional regular expression patterns(?) I am contemplating a kind of two dimensional regular expression based on strings. These patterns would operate on strings that were defined as an mXn array of characters, though the actual implementation is planned to be a single string. Resizing the mXn would be an expensive operation, but the built-in operations on strings make it appear to be the best choice. (Actually, even were I doing this in C, I would choose to map the a[m][n] logical array into an a[m*n] array for implementation, but with the built-in pattern operations the choice seems open and shut.) A sample pattern might look like this: 22.2.22 \\^//. 55l .3d .led. //ed. 3..V..\ ...3...3 Here the desired interpretations are: a == anchor, this is where the interpretation begins d == darker than the anchor (could be g for greater than the anchor) l == lighter than the anchor (could be for less than the anchor) e == equal to the anchor ^ == carry the pattern up V == carry the pattern down > == carry the pattern to the right < == carry the pattern to the left / == carry the pattern at a diagonal away from the anchor at 45 or 225 degrees \ == carry the pattern at a diagonal away from the anchor at 135 or 315 degrees . == don't care # == the number of times to carry the pattern in this direction + == carry the pattern once or twice ? == carry the pattern zero or one time * == carry the pattern an optional distance Places where I would consider using this are in an algorithm for recognizing icons in images (colors would need to be reduced to fit into string values [16 bits?]) and to describe the possible movements of pieces in a board game, e.g., chess. Does anyone know of anything like this? -- Charles Hixson Copy software legally, the GNU way! Use GNU software, and legally make and share copies of software. See: http://www.gnu.org http://www.redhat.com http://www.linux-mandrake.com http://www.calderasystems.com http://www.linuxapps.com