M
micklee74
hi
i created a script to ask user for an input that can be a pattern
right now, i use re to compile that pattern
pat = re.compile(r"%s" %(userinput) ) #userinput is passed from
command line argument
if the user key in a pattern , eg [-] , and my script will search some
lines that contains [-]
pat.findall(lines)
but the script produce some error: sre_constants.error: unexpected end
of regular expression
how can i successful catch patterns such as "[-]" in my regexp
compilation where input is unknown...?
thanks
i created a script to ask user for an input that can be a pattern
right now, i use re to compile that pattern
pat = re.compile(r"%s" %(userinput) ) #userinput is passed from
command line argument
if the user key in a pattern , eg [-] , and my script will search some
lines that contains [-]
pat.findall(lines)
but the script produce some error: sre_constants.error: unexpected end
of regular expression
how can i successful catch patterns such as "[-]" in my regexp
compilation where input is unknown...?
thanks