diff --git a/RevenueCatUI/Data/Variables.swift b/RevenueCatUI/Data/Variables.swift index 5c03043566..364312894f 100644 --- a/RevenueCatUI/Data/Variables.swift +++ b/RevenueCatUI/Data/Variables.swift @@ -48,17 +48,7 @@ enum VariableHandler { } private static func extractVariables(from expression: String) -> [VariableMatch] { - let variablePattern = Regex { - OneOrMore { - "{{ " - Capture { - OneOrMore(.word) - } - " }}" - } - } - - return expression.matches(of: variablePattern).map { match in + return expression.matches(of: Self.regex).map { match in let (_, variable) = match.output return VariableMatch(variable: String(variable), range: match.range) } @@ -71,6 +61,16 @@ enum VariableHandler { } + private static let regex = Regex { + OneOrMore { + "{{ " + Capture { + OneOrMore(.word) + } + " }}" + } + } + } @available(iOS 16.0, macOS 13.0, tvOS 16.0, *)