using regex with a variable to search a sentence

I am using the following regex to seach a sentence and want to match only values that are followed by a period. I am confused to why the following regex is true since the ta isnt followed by a period. How would I change it so doesnt match?


let text = 'Paracetamol takes up to an hour to work. to '

let regex = new RegExp("ta" + ".", "i")
console.log(regex.test(text))