Skip to content
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

Bug fixes #75

Merged
merged 2 commits into from
Dec 10, 2017
Merged

Bug fixes #75

merged 2 commits into from
Dec 10, 2017

Conversation

rebe1one
Copy link
Contributor

@rebe1one rebe1one commented Nov 30, 2017

Fix for issue #65

@rebe1one rebe1one changed the title Update regex to support newlines in string values. Bug fixes Nov 30, 2017
@@ -294,7 +294,7 @@ public class StringsFileUpdater {
// - Returns: An array containing all found translations as tuples in the format `(key, value, comment?)`.
func findTranslations(inString string: String) -> [TranslationEntry] {
// comment pattern adapted from http://blog.ostermiller.org/find-comment
let translationRegexString = "(?:\\s*/\\*(((?:[^*]|(?:\\*+(?:[^*/])))*))\\*+/\\s*)?\\s*(?:^\\s*\"([\\S  ]*)\"\\s*=\\s*\"([\\S  ]*)\"\\s*;\\s*$)"
let translationRegexString = "(?:\\s*/\\*(((?:[^*]|(?:\\*+(?:[^*/])))*))\\*+/\\s*)?\\s*(?:^\\s*\"([\\S  ]*)\"\\s*=\\s*\"(.*?)\"\\s*;\\s*$)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why's there a question mark in there? Isn't .* already allowing the same as .*??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.* by itself will match greedily, so it will not stop at the first blahblah"; that it finds. The addition of the question mark makes the match lazy, so it will stop there.

@Jeehut
Copy link
Member

Jeehut commented Dec 7, 2017

I've added a comment. Once that's cleared out I'm happy to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants