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.
- the string cannot end with "."
- the string must contain at least one "." char
- the last string should support the "$" char
some patterns I've tried: ^((apple|orange|tomato)(\\.|$))*$ but it seems to allow the string to end with "." and to not contain a "."