I'm trying to understand what the repeated (?i) syntax means in the following code:
i = self.expect([
"(?i)are you sure you want to continue connecting",
original_prompt,
"(?i)(?:password)|(?:passphrase for key)",
"(?i)permission denied",
"(?i)terminal type",
TIMEOUT,
"(?i)connection closed by remote host"
], timeout=login_timeout)
This is documented under the heading for
(?aiLmsux-imsx:...)in https://docs.python.org/3/library/re.html, as follows:Thus,
(?i)is an inline version of the flag that is otherwise set asre.I, orre.IGNORECASE; it makes the match case-insensitive, such thatpermission deniedcould also be writtenPermission DeniedorPERMISSION DENIEDbut would still be matched.