title: remove url from a given string in c#
body: <p>I tried doing this</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Text;
  
  namespace UrlsDetector
  {
      class UrlDetector
      {
          public static string RemoveUrl(string input)
          {
              var words = input;
              while(words.Contains(&quot;https://&quot;))
              {
                  string urlToRemove = words.Substring(&quot;https://&quot;, @&quot; &quot;);
                  words = words.Replace(&quot;https://&quot; + urlToRemove , @&quot;&quot;);
              }
          }
          
      }
  
      class Program
      {
          static void Main()
          {
              Console.WriteLine(UrlDetector.RemoveUrl(
                  &quot;I saw a cat and a horse on https://www.youtube.com/&quot;));
  
          }
      }
  }
  </code></pre>
  <p>but it doesn't work</p>
  <p>what I want to achieve is remove the entire &quot;https://www.youtube.com/&quot; and display &quot;I saw a cat and a horse on&quot;</p>
  <p>I also want to display a message like &quot;the sentence you input doesn't have url&quot; if the sentence doesn't have any url. but as you can I didnt put any code to do that I just need to fix this code first but if you want to help me do that too, I gladly appreciated it.</p>
  <p>thanks for responses.</p>