I have a list of words:
const words = ["apple", "orange", "tomato"]
const str = "apple.orange.tomato.$COULD_$_BE_ANY_STRING_HERE"
I am looking for the regex to validate this string structure.
some patterns I've tried: ^((apple|orange|tomato)(\\.|$))*$ but it seems to allow the string to end with "." and to not contain a "."