I'm trying to use a pattern to find a certain line in a file, but it's not working.
This is my pattern: row = re.compile(r"(|\s[OX\s]\s{3}|)")
With this I want to basically find this pattern: | | O | X |
, that is, I want that in the middle of the | |
pipes can exist only on the left side: espaço
, in the middle: 0
or X
or espaço
, right: espaço
. I would like to return None
if the pattern is not exactly like that, but it is not working.
row = re.compile(r"(|\s[OX\s]\s{3}|)")
exp = re.match(row, line)
If line
is different, for example instead of | X | | |
, I have | X |
, it works the same!
What's the problem?