我想还是让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