python regular expression to check if string contains substring -
i want create code return true if string contains word "post". when give code string "postgre", "postgres", "sqlpost" - return true. how can it?
you don't need regex this. use in
operator:
>>> word = 'post' >>> word in 'postgres' true >>> word in 'sqlpost' true >>> word in 'fish' false
Comments
Post a Comment