for [token], start, end in expr.scanString(
    """{keyword} should match
    /*
    {keyword} should not match "
    */
    // this {keyword} also shouldn't match
    "neither this \\" {keyword}"
    but this {keyword} will
    re{keyword} is ignored
    '{keyword}' - also match (only double quoted strings are ignored)
    """
    .format(keyword=keyword)):
    assert token == keyword and len(keyword) == end - start
Trying to find all instances of a keyword NOT in comments or literals?