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

Wrap regexes in quotes #23

Merged
merged 2 commits into from
Feb 20, 2024
Merged

Wrap regexes in quotes #23

merged 2 commits into from
Feb 20, 2024

Conversation

FloEdelmann
Copy link
Member

Without quotes, YamlKt (and maybe other parsers) don't parse these values correctly. I've noticed this while implementing streetcomplete/StreetComplete#5490.

@westnordost
Copy link
Member

I'd prefer double quotes

@FloEdelmann
Copy link
Member Author

FloEdelmann commented Feb 20, 2024

With double quotes, we'd need to escape the backslashes, which IMO would be ugly and impractical (e.g. for copying the regex to regexper.com etc.).

- '([\p{N}\p{L}]{1,2}\s?/\s?|\p{L}{1,2}\s?)?\p{N}{1,5}'
+ "([\\p{N}\\p{L}]{1,2}\\s?/\\s?|\\p{L}{1,2}\\s?)?\\p{N}{1,5}"

(I tried double quotes first, see the commit history, but then ran into a parsing error telling me that \p is an invalid escape sequence.)

@westnordost westnordost merged commit 1041d52 into streetcomplete:master Feb 20, 2024
@FloEdelmann FloEdelmann deleted the patch-1 branch February 20, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants