Skip to content

feat(regexp): update parseRegExpString to support modern regex flags (u, s)#93

Open
myakura wants to merge 2 commits into
prh:masterfrom
myakura:task-04-update-parseRegExpString-flags
Open

feat(regexp): update parseRegExpString to support modern regex flags (u, s)#93
myakura wants to merge 2 commits into
prh:masterfrom
myakura:task-04-update-parseRegExpString-flags

Conversation

@myakura
Copy link
Copy Markdown
Contributor

@myakura myakura commented Apr 28, 2026

概要

ES2020までに追加された新しいフラグをregexp.tsのparseRegExpString()に追加し、これらを認識できるようにします。

Summary

  • Update parseRegExpString to recognize u (unicode) and s (dotAll) flags
  • Previously, flags like /pattern/us in YAML config would silently drop u and s flags
  • Add comprehensive tests for modern flag parsing

Changes

  • lib/utils/regexp.ts: Updated regexpRegexp pattern from /^\/(.*)\/([gimy]*)$/ to /^\/(.*)\/([gimsuy]*)$/
  • test/utils/regexpSpec.ts: Added 3 new test cases:
    • Unicode flag (/\\p{Script=Han}/u)
    • dotAll flag (/./s)
    • Combined modern flags (/pattern/gimsuy)

Testing

All 32 regexp tests pass. The fix ensures users can now use u and s flags in their YAML rule patterns.

- Update regexpRegexp pattern to capture u (unicode) and s (dotAll) flags
- Add tests for unicode flag, dotAll flag, and combined modern flags
- Fixes issue where /pattern/us in YAML config would silently drop u and s flags
@myakura myakura requested a review from vvakame as a code owner April 28, 2026 23:48
@myakura myakura changed the title Update parseRegExpString to support modern regex flags (u, s) feat(regexp): update parseRegExpString to support modern regex flags (u, s) Apr 28, 2026
- Mark task 04 as implemented in ROADMAP.md (PR prh#93 opened)
- Update issue.md with completed status and PR link
- Update regexp-modernization.md with implemented status
- Update regexp-bugs.md to show issue is fixed
Copy link
Copy Markdown
Collaborator

@vvakame vvakame left a comment

Choose a reason for hiding this comment

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

thanks to contributios!
Could you remove ‎_myakura/ directory?

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