Given a string of arbitrary length, a newline and another string of the same length, is it possible to produce regex that will match the character directly below a character on the first line?
For example, what single regex pattern could capture the character below X for all these inputs:
........X.. and .X......... and .....X..... etc.
........... ........... ...........
It seems to me, that you must know the position of X in order to get match the character underneath. Manually i can figure out that the pattern
X\.+\n.{8}(.)
that captures the character underneath X in this example
........X..
...........
since i know that X is is the 9th character on the first line. This however doesn't work if X has any other position, which is the core of the problem.
So the question is: Is it possible to create a pattern in regex, that matches the character underneath another character, and what would that look like?