【问题标题】:Attributes in SwiftLint custom regex-based rulesSwiftLint 自定义基于正则表达式的规则中的属性
【发布时间】:2016-09-09 03:16:17
【问题描述】:

我正在为SwiftLint 创建自定义规则,用于检查color 的拼写。我需要它不区分大小写。

我目前正在使用regex: "([C|c]olour)" 进行匹配,但我想使用不区分大小写的修饰符/i。我尝试了以下规则,但它不起作用:

custom_rules:
  color_us_english:
    regex: "(colour)/i"
    message: "Use US English spelling to match Apple's API."
    severity: warning

如何在 SwiftLint 中使用修饰符?

【问题讨论】:

    标签: regex swiftlint


    【解决方案1】:

    可能不支持以下内容:

    "(colour)/i"
    

    请尝试:

    "(?i)(colour)"
    

    看看这个example。

    【讨论】:

      猜你喜欢
      • 2016-07-22
      • 2018-07-13
      • 2018-01-10
      • 1970-01-01
      • 1970-01-01
      • 2011-12-02
      • 1970-01-01
      • 1970-01-01
      • 2013-12-17
      相关资源
      最近更新 更多