Skip to content

fix: 修复正则表达式匹配逻辑,确保正确返回所有匹配项#321

Merged
YufJi merged 1 commit into
testfrom
bugfix/MatchRegex
Jan 14, 2026
Merged

fix: 修复正则表达式匹配逻辑,确保正确返回所有匹配项#321
YufJi merged 1 commit into
testfrom
bugfix/MatchRegex

Conversation

@YufJi
Copy link
Copy Markdown
Collaborator

@YufJi YufJi commented Jan 14, 2026

Summary by CodeRabbit

发布说明

  • Bug Fixes
    • 优化了正则表达式匹配功能,现在能够正确识别并返回字符串中的所有匹配结果,而不仅限于第一个匹配项。改进了对全局标志的处理,防止无限循环问题。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 14, 2026

Caution

Review failed

The pull request is closed.

概览

MatchRegex函数从使用单次str.match调用改为通过RegExp.exec循环实现,现在返回输入字符串中所有匹配项而非仅第一个。新增了正则表达式迭代逻辑和无限循环防护机制。

变更内容

文件组 / 文件 变更摘要
核心函数逻辑修改
packages/basic/src/sdk/modules/utils.ts
MatchRegex函数实现重构:替换str.match为RegExp.exec循环以收集全部匹配项;新增内部变量用于迭代管理;新增全局标志检查逻辑;新增无限循环防护通过推进lastIndex;改变函数行为使其返回所有匹配而非仅第一个

估计代码审查工作量

🎯 2 (Simple) | ⏱️ ~10 minutes

可能相关的PR

推荐审查者

  • suica

兔子的庆祝诗

🐰 正则匹配大变身,
从一个变成一群!
循环执行exec法,
全部收集不遗漏,
逻辑更新真不错✨

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 424b458 and b86f79b.

📒 Files selected for processing (1)
  • packages/basic/src/sdk/modules/utils.ts

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@YufJi YufJi merged commit 7a47089 into test Jan 14, 2026
1 of 2 checks passed
@YufJi YufJi deleted the bugfix/MatchRegex branch January 14, 2026 08:55
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.

1 participant