+ 2
Regex pattern as user input
How can i manage to give a pattern to my program, as user input? I try to give: ^[A-Z][a-z]+\s\d+\.\d but it does not work with the ^ sign. whyyyyyyy???
2 Answers
0
are you using raw_input() ?
0
i use python 3, and there is no raw_ input, google says, that input() does the same. I try to use pattern = input(), or pattern = re.compile("{0}".format(input(pattern)) ,not sure, it does the same. i dont know how to put the user input in r'pattern'.