New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid escape sequence in literal since 6.6.2 #1073
Comments
Could you provide more inputs on this? Like your configuration or some sample code to reproduce this issue? |
Here is an example project: I have
SwiftGen produces: internal enum Localized {
/// ^[a-zA-Z0-9\/]*$
internal static var houseNumberAndSuite: String { return Localized.tr("Localizable", "house_number_and_suite", fallback: "^[a-zA-Z0-9\/]*$") }
/// ^(\+?48\s?)?[0-9]{3}\s?[0-9]{3}\s?[0-9]{3}$
internal static var phoneNumber: String { return Localized.tr("Localizable", "phone_number", fallback: "^(\+?48\s?)?[0-9]{3}\s?[0-9]{3}\s?[0-9]{3}$") }
/// ^[0-9]{2}-[0-9]{3}$
internal static var postalCode: String { return Localized.tr("Localizable", "postal_code", fallback: "^[0-9]{2}-[0-9]{3}$") }
} And I get "Invalid escape sequence in literal" error for the first two strings. |
I get the same error |
I use
.strings
files for country-based regular expressions like postal code validation. Since thefallback
attribute was introduced in 6.6.x, I get "Invalid escape sequence in literal" compiler error for strings like"^[a-zA-Z0-9\\/]*$"
which is replaced with"^[a-zA-Z0-9\/]*$"
for the fallback value.The text was updated successfully, but these errors were encountered: