Finding words after keyword in python
Instead of using regexes you could just (for example) separate your string with str.partition(separator)
like this:
mystring = "hi my name is ryan, and i am new to python and would like to learn more"keyword = 'name'before_keyword, keyword, after_keyword = mystring.partition(keyword)>>> before_keyword'hi my '>>> keyword'name'>>> after_keyword' is ryan, and i am new to python and would like to learn more'
You have to deal with the needless whitespaces separately, though.