How can I extract the word following “text:” using a regular expression? The input is something like:
some string some string (text:the_word_i_want_to_get some string) some string
some string some string (text:next_word_i_want_to_get some string) some string
and the output should be:
["the_word_i_want_to_get", "next_word_i_want_to_get"]
You can match the first occurrence of your word like this:
To get all of the matches, you could put it in a loop: