in reply to RegEx Beginning of line or whitespace match

/^\s*(for\()/ should work. Use '^' to require that the match occurs at the beginning of a line rather than anywhere within the line.