[Regex]::Matches($string, '((https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-](.*?)(?=\s))').Value
Match URL with optional protocol
PS C:\> $string = 'You can find tons more PowerShell examples at https://www.dowst.dev/category/strings/regex/ with new stuff uploaded every day' >> [Regex]::Matches($string, '((https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-](.*?)(?=\s))').Value https://www.dowst.dev/category/strings/regex/