【问题标题】:RegexKitLite match?RegexKitLite 匹配?
【发布时间】:2011-08-30 04:54:58
【问题描述】:

我想将字符串 aaaa{\"type\":\"video\",\"title\":\"a\",manyothershere\"}ssss 替换为 aaaa[视频]ssss

这意味着字符串 {"type":"video","title":"a",balabala"} 到 [video]

我使用 RegexKitLite,我尝试了下面的代码,但它不起作用。

    NSString *videoRegexString = @"{\"type\":\"video\",.+\"}";

NSString *replacedStr = [@"aaaa{\"type\":\"video\",\"title\":\"sdf\",manyothershere\"}ssss" stringByReplacingOccurrencesOfRegex:videoRegexString withString:@"[video]"];

我想replacedStr 是“aaaa[video]ssss”,但它是 nil 我错了吗?

【问题讨论】:

    标签: iphone regexkitlite


    【解决方案1】:

    尝试NSString *videoRegexString = @"{\"type\":\"video\",.+?\"}";(注意问号).+ 可能正在消耗\"}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-09
      • 1970-01-01
      相关资源
      最近更新 更多