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

Add angle brackets to wordPattern regexp #315

Merged
merged 2 commits into from
Sep 7, 2023

Conversation

DenisGorbachev
Copy link
Contributor

Before: https://regexr.com/7iki6 (matches the angle brackets, looks odd)

After: https://regexr.com/7ikh2 (does not match the angle brackets, looks correct)

P.S. This PR includes the changes made by #314.

Since "-" was not escaped, the sequence ")-=" was treated as "a range from ) to =". 

Escaping "-" fixes this.

Examples:

```
const r = new RegExp("([^`~@$%^&*()\\-=+\\[{\\]}⟨⟩⦃⦄⟦⟧⟮⟯‹›\\\\|;:\",./\\s]+)")

'SomeName123'.match(r)[0] === 'SomeName123'
'Some-Name-123'.match(r)[0] === 'Some'
```

P.S. Two backslashes are needed because the "wordPattern" is a key in a JSON file, which requires its own escape sequence.
@mhuisi mhuisi merged commit a8659be into leanprover:master Sep 7, 2023
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