有没有人知道怎么写Regex.Split才能转换
{视频= “我/视频/ file.flv,我/ location.jpg”}
到
答案 0 :(得分:1)
像这样:
new Regex(@"[{="",}]").Split(@"{video=""my/video/file.flv,my/location.jpg}").Where(s => s.Length > 0)
编辑:在VB中:
Dim regex As New Regex("[{="",}]")
Dim myStr = "{video=""my/video/file.flv,my/location.jpg}"
Dim results = regex.Split(myStr).Where(Function(s) s.Length > 0)
答案 1 :(得分:0)
您是否考虑过使用拆分功能?
string x = "{video=\"my/video/file.flv,my/location.jpg\"}";
string xx = x.Split(',');
答案 2 :(得分:0)
这项工作对我来说似乎已经成功了。想法?
Dim str As String = "this is exciting {video=""my/exciting/video.flv,my/refreshing/image.jpg""} this is refreshing"
Dim regFind As String = "(?'text'\{video=""(.*)\""})"
Dim matcher As Match = Regex.Match(str, regFind)
Dim Matched As String() = (matcher.Groups("text").Value).Split(",")
Dim video As String = Matched(0).Replace("{video=""", "")
Dim jpg As String = Matched(1).Replace("""}", "")
Response.Write(video)
Response.Write("<br />")
Response.Write(jpg)