regex - Python: 'q)+' is not recognized as an internal or external command -
python newbie here.
i have program named zeroormore.py
it reads regular expression (regex) stdin.
i invoke program this:
python zeroormode.py (ab)*(p|q)+ that results in error message:
'q)+' not recognized internal or external command, operable program or batch file. i discovered if enclose regex in double quotes:
python zeroormode.py "(ab)*(p|q)+" then there no error.
is there way accomplish without wrapping regex in double quotes? here's how program inputs regex:
regex = sys.argv[1]
this isn't python; it's cmd. regex you're giving python being interpreted command prompt first. pipe (|) batch command piping input following program. basically, cmd reading command line so:
python zeroormode.py (ab)*(p | q)+ it's trying take result of running zeroormode.py (i think meant more?) (ab)*(p , piping output (nonexistent) program q)+.
there isn't of solution this, unfortunately. escape pipe so:
python zeroormode.py (ab)*(p^|q)+ the caret (^) cause special meanings next character has ignored.
Comments
Post a Comment