我想還是讓MP3的名稱匹配空白和不空白
我目前使用此代碼
string str = "onClick=\"playVideo('upload/honour-3.mp3',this)\"/> onClick=\"playVideo('upload/honor is my honor .mp3',this)\"/> onClick=\"playVideo('upload/honour-6.mp3',this)\"/> ";
string Pattern = @"playVideo\(\'upload\/(?<mp3>\S*).mp3\'\,this\)";
if (Regex.IsMatch(str, Pattern))
{
MatchCollection Matches = Regex.Matches(str, Pattern);
foreach (Match match in Matches)
{
string fn = match.Groups["mp3"].Value;
Debug.Log(match.Groups["mp3"].Value);
}
}
但\ S *匹配只喜歡
榮譽-3
榮譽-6
我不能得到 「的榮譽是我的榮幸」
我嘗試了「\ S * \ S *」,但它不能正常工作
我有不確定的很多多少空字符串的
如何使用正則表達式來獲得MP3的名字嗎?
不會''做job..If你願意,你可以用'上傳\ /(?(\ S | \ s)*)。 mp3'代替 –
rock321987