I want to search if a string contains the following pattern which simply consists of two - signs (hyphens) separated with single words, not phrases or sentences:
word - word - word
Other conditions simply could be ignored. Spaces between don't affect the pattern so the above pattern and this one are the same:
word - word-word
If there is such a pattern I want to return true and else I want a false obviously!
So far I split the string by hyphens and check if there are two of them only and there are only 3 single words not more and not less, but I think there may be a more efficient way...