Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add a solution that enables the direct use of atomic groups#3699

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
slevithan wants to merge1 commit intojavascript-tutorial:master
base:master
Choose a base branch
Loading
fromslevithan:patch-1

Conversation

slevithan
Copy link

The catastrophic backtracking solution described where atomic groups are emulated using lookahead and backreferences is useful but can be tricky to use and error prone (e.g. when quantifying the result, or in longer patterns that rely on multiple atomic groups). So this adds a link to an easy to use solution that enables the direct use of atomic groups via(?>…) in native JS regexes.

@javascript-translate-botjavascript-translate-bot added the review neededReview needed, please approve or request changes labelJun 5, 2024
@javascript-translate-botjavascript-translate-bot requested a review froma teamJune 5, 2024 13:20
@CLAassistant
Copy link

CLAassistant commentedJun 5, 2024
edited
Loading

CLA assistant check
All committers have signed the CLA.

@javascript-translate-botjavascript-translate-bot added needs +1One more review needed and removed review neededReview needed, please approve or request changes labelsJun 6, 2024
@slevithan
Copy link
Author

I updated the PR to make some additional tweaks:

  • Atomic groups don't capture, so I changed "atomic capturing groups" to "atomic groups" (their correct name).
  • The emulation trick (with a backreference to a capturing group inside a lookahead) emulates an atomic group, not a possessive quantifier, so I corrected this. This distinction is subtle since possessive quantifiers are sugar for some common uses of atomic groups, but it is important. For example, the lookahead/capture trick accurately emulates the behavior of an atomic group like(?>…|…) which is not followed by a quantifier at all.

@slevithanslevithan changed the titleAdd a solution for that enables the direct use of atomic groupsAdd a solution that enables the direct use of atomic groupsJul 2, 2024
@smith558smith558 self-assigned thisJul 10, 2024
@smith558smith558 requested review fromAlexandre887 and removed request forCyberAnilpatilJuly 10, 2024 15:16
The solution described where atomic groups are emulated using lookahead and backreferences is useful but can be tricky to use and error prone (e.g. when quantifying the result, or in longer patterns that rely on multiple atomic groups). So this adds a link to an easy to use solution that enables the direct use of atomic groups via `(?>…)` in native JS regexes.
@slevithan
Copy link
Author

Ping@Alexandre887 for review. This PR makes this (already quite informative) article even better for readers.

@slevithan
Copy link
Author

Hey@smith558, any problem with landing this PR as is?

@Alexandre887
Copy link
Member

Hey@slevithan, just want to make it clear that PRs are reviewed by volunteers here, so there is no strict timetable for when a particular PR will be merged or anything like that — it's directly dependent on the availability of free time and willingness to review a particular PR. So if there is no response for a long time, it doesn't mean that your PR has been forgotten about, or that it has some flaws (otherwise someone would have said you about it). Thanks for your patience.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@CyberAnilpatilCyberAnilpatilCyberAnilpatil approved these changes

@Alexandre887Alexandre887Awaiting requested review from Alexandre887

Assignees

@smith558smith558

Labels
needs +1One more review needed
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@slevithan@CLAassistant@Alexandre887@CyberAnilpatil@smith558@javascript-translate-bot

[8]ページ先頭

©2009-2025 Movatter.jp