Sebastian probst Eide wrote:
> I thought I could check by looking for something like this:
>
> text =~ /[[:punct:]]\s?WORD_I_AM_LOOKING_FOR/
> and if I got something else than 0 as a result it would mean that the
> word is in the beginning of a sentence. But how do I insert a variable
> into the regular expression? 
Use #{}, like this

word = "hello"

test =~ /[[:punct:]]\s?#{word}/

"word" can be any regular expression.