?
string ul = "https://example.com/pinterest";
ul = ul.Replace("https://","");
ul = ul.Replace("http://", "");
ul = ul.Replace("www.", "");
var reg = Regex.Matches(ul, "(.*)/pin");
if (reg[0].Groups[1].Value.ToString().Contains("pinterest")) {
MessageBox.Show("ok");
}
https://stackoverflow.com/help/how-to-ask
let ul = "https://example.com/pinterest"; ul = ul.replace("https://","").replace("http://", "").replace("www.", ""); if(ul.match("(.*)/pin")[0].includes("pinterest")){ console.log("ok") }
In JS the replace method can take regular expression, so you can shorten your ul.replace stuff to something like ul.replace(/^(.+\/)?(www\.)?/, "") to get it all done in one fell swoop
yes but I couldn't make the regex I need I want this *pinterest.*/pin/* which * may be different the first * between http:// and https:// with or without www.
Обсуждают сегодня