I want to use a negative lookahead regular expression. In this case, find the last occurence of an open round bracket.
- Code: Select all
regex = "\((?!.*\()"
search = "print (\"Current line range: \" + str(current_line(..."
result = search.find(regex)
The result is always -1, so my regualar expression seems to be wrong. How do I define it correctly?