Earlier quoted context omitted.
" but the interview engine is already running at full speed:" I dont know if this is a recent thing, but I had a similar thing where an interviewer was racing forward, and would only accept the answers he had in mind. In Python, he asked me how to search for substring. I was thinking but he started hurrying me. So I said regex and started writing a regex. "No, there is an inbuilt method" I couldnt remember the method…
I probably would've done the same. "I don't remember what the function is called" would've been fine-ish, but reaching for a regex is just insane.
But more importantly it is hugely context sensitive on how often the function is going to be called and what IO needs to happen around it to decide if speed matters at all.
Using a regex as a first attempt is entirely reasonable. Especially in an interview about Python. If we care about efficiently doing substring matching Python isn't the language of choice. If a programmer just wants to remember how regex work and get on with their day they'll do fine at handling string problems.