我試圖修改以下字符串在C#中使用System.Text.RegularExpressions.Regex
,我需要用/
替換/(integer)x(integer)/
。例如在url
中,我需要將/1080x1080/
更換爲/
。我怎樣才能做到這一點?我研究過正則表達式,但我無法弄清楚如何去做。使用正則表達式修改字符串
string url = "https://scontent-icn1-1.cdninstagram.com/t51.2885-15/1080x1080/22158936_1794137857546339_3682912105310191616_n.jpg";
//The link is actually invalid because I modified it
查看MSDN良好的參考:https://docs.microsoft。 com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference – jdweng