Refer CONTAINS function use cases and examples article.
- Search for text.
- Check if an unknown string or character matches a defined set of strings or characters.
Example of searching for text.
Returns TRUE if "BadWord" is found anywhere in Comments__c.
Example of searching for unknown string or characters.
Will return true for TextField__c values such as 1,2,9,01,789, or any other substring of "0123456789"
For your question, If i have "test account" in the account__r.lookup__r.Name, and "test account" in the text_field__c it works. However, if I leave it blank, or type in a random word for text_field__c that does not match account__r.lookup__r.Name and vice versa, it still marks it true.
The second example is working.
Update based on comments
REGEX instead of
The Salesforce regular expression engine matches an entire string as opposed to searching for a match within a string. For example, if you are searching for the name Marc Benioff, use the regular expression, .*Marc Benioff.*, to find a match in a string like the following:
According to Marc Benioff, the social enterprise increases customer success.
If you use the regular expression, Marc Benioff, the only string that this regular expression will match is: