I found the regExp
var pattern:RegExp = new RegExp("\(\?\<\=\\s)" + string + "(?=[\\s|\,])", "ig");
someone wrote it back in 2011.
I want to use it in my code in order to find the word string in a given text. It has to be a whole word. The problem is that it finds the "string" only if it is not at the begining of the text and if it is not at the end of the text. what can I do in order to find also the first and the last line of the text (the first word doesn't have a space before it, and the last one doesnt have a space or a punctuation after it.