Here are some words to consider:
const words = ["apple", "orange", "tomato"]
const str = "apple.orange.tomato.$COULD_$_BE_ANY_STRING_HERE"
I am in search of a regular expression to verify the format of this string.
- The string cannot finish with "."
- It must include at least one instance of "."
- The final part of the string needs to accommodate the "$" character
I've tested various patterns, such as
^((apple|orange|tomato)(\\.|$))*$
, but it seems to permit the string ending with "." and lacking a "."