In [7]:
import re
rpfor = re.compile(r"""^FOR\s+(?P<operando1>\S+)\s+(?P<start>\S+)\s+(TO\s+)?(?P<stop>\S+)""")

In [14]:
line = 'FOR #IND1        1       5'

In [15]:
match = rpfor.match(line)
match = match.groupdict()
start = match['start']
stop = match['stop']

In [29]:
line = "IF #CAMPO-EQ-PE2-NUM(#IND1)       EQ  MASK ('    'N)"
re.search(r'\s(EQ)\s', line)


Out[29]:
<_sre.SRE_Match at 0x4fbfe40>