1

I am creating custom rule for SwiftLint that checks the spelling of color. I need this to be case insensitive.

I am currently matching using regex: "([C|c]olour)" but I would like to use the case insensitive modifier /i. I have tried the following rule but it doesn't work:

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

How do you use modifiers in SwiftLint?

1 Answers1

1

It could be that the following is not supported:

"(colour)/i"

Please try:

"(?i)(colour)"

Have a look at this example.

AKS
  • 18,983
  • 3
  • 43
  • 54