Skip to content

feat: add regex support to operator_contains#330

Merged
takaokouji merged 1 commit into
developfrom
feature/operator-contains-regex
Mar 18, 2026
Merged

feat: add regex support to operator_contains#330
takaokouji merged 1 commit into
developfrom
feature/operator-contains-regex

Conversation

@takaokouji
Copy link
Copy Markdown

@takaokouji takaokouji commented Mar 18, 2026

Summary

operator_contains ブロックの STRING2 に /pattern/flags 形式を指定すると、正規表現マッチングを行うようにする拡張。

  • /pattern/ または /pattern/flags 形式を検出し、RegExp でマッチング
  • フラグ g, i, m, s, u, y をサポート
  • 不正な正規表現・不正なフラグは false を返す(エラーにならない)
  • 既存の部分文字列検索(スラッシュなし)は完全に維持

Implementation Steps

  • [RED] ユニットテスト追加(失敗確認)
  • [GREEN] contains メソッドに正規表現ロジック実装
  • [PASS] lint + テスト pass
  • [COMMIT & PUSH]
  • [MAKE PR]
  • CI green 確認
  • ブラウザ確認(Playwright MCP)

Definition of Done

  • ユニットテスト pass
  • lint pass
  • CI green
  • ブラウザ確認(Playwright MCP):
    • operator_contains ブロックの STRING2 に /\d+/ を入力し、STRING1 に "abc123" を入力して true になる
    • /hello/i で大文字小文字無視マッチが動作する
    • 通常の文字列検索(apple contains a)が引き続き動作する
    • 不正な正規表現(/[/)でエラーにならない

Risks

  • /文字列/ で部分文字列検索するケースが正規表現として解釈される → 稀なケースのため許容
  • ReDoS でフリーズする可能性 → ユーザー責任として許容

Closes #329

When STRING2 matches /pattern/ or /pattern/flags format, perform
regex matching instead of plain substring search. Invalid regex
patterns return false. Existing plain string behavior is preserved.

Closes #329

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

@takaokouji takaokouji merged commit 7105aa6 into develop Mar 18, 2026
9 checks passed
@takaokouji takaokouji deleted the feature/operator-contains-regex branch March 18, 2026 13:00
github-actions Bot pushed a commit that referenced this pull request Mar 18, 2026
…tor-contains-regex

feat: add regex support to operator_contains
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.

feat: add regex support to operator_contains

1 participant