用 Regex 擷取中括弧&取代空白
Regex.Escape 太酷了!
[syntax="csharp"]
string input = "[>999999999] 0917307543 [>999999999] [>999999999]";
string pattern = Regex.Escape("[") + "(.*?)]";
MatchCollection matches = Regex.Matches(input, pattern);
string result = input;
foreach (Match match in matches)
{
result = result.Replace(match.Value, string.Empty);
}
[/syntax]
用 Regex 擷取中括弧&取代空白
誰在線上
正在瀏覽這個版面的使用者:沒有註冊會員 和 1 位訪客