find domain with regex in text site:stackoverflow.com code example
Example 1: unity search for specific text in a string
public string testString = "I hope this help you";
public string otherCase = "I hope";
public void SearchForText()
{
if(testString.Contains("you"))
{
Debug.Log("The variable testString contains the word you")
}
if(testString.Contains(otherCase))
{
Debug.Log("The variable testString contains the value of the variable otherCase")
}
}
Example 2: javascript regex get domain from url
function url_domain(data) {
var a = document.createElement('a');
a.href = data;
return a.hostname;
}