Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

stdDate.RegexMatch ignores options and looks up a different cache key

オープン 初心者向け
#171 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
77/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
領域
backend

調査の方向性

src/WIP/stdDate.cls の RegexMatch 付近(932行目と954~955行目)を読み、検索に使われるキャッシュキーと、保存および実行に使われるキーを比較してください。キーの検索を修正し、options パラメーターを反復処理してから、提供された Excel VBA の例で再現し、呼び出しの繰り返しとオプションの切り替えを確認してください。この例が AbC を返し、列挙されたオプションのケースが通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

src/WIP/stdDate.cls at current blob b204aa6104d1dadbeb85b3381ed9c73f718c99ba contains two small defects in RegexMatch:

  1. The parameter is named options, but lines 954–955 iterate flags. With no Option Explicit, flags is an implicit Empty Variant, so the options loop never runs.
  2. Line 932 reads CachedRegex(pattern), while storage and execution use options & ")" & pattern. A missing Scripting.Dictionary Item read adds an Empty entry. The mismatch therefore rebuilds the RegExp on every call and adds an extra empty entry per unique pattern.

Minimal Excel VBA reproduction:

Dim d As Object
Set d = stdDate.RegexMatch("AbC", "(?<v>abc)", "i")
Debug.Print d("v")

Expected: AbC. Current source produces runtime error 5 because IgnoreCase remains False and the function indexes the empty match collection. With the three substitutions below, this call succeeds in a fresh Excel instance and in 1,000 repeated calls.

If Not CachedRegex.Exists(options & ")" & pattern) Then
' ...
For i = 1 To Len(options)
    Select Case Mid(options, i, 1)

A separate instrumented local copy counted 10 RegExp creations for 10 calls before the fix and 1 afterward. Simple i/s/m/x/empty-option and option-switching cases passed, as did a full Excel VBE compile. Local patch/reference: https://github.com/Keunil/robotic-application/pull/1461

Timing improvement was inconsistent across two local A/A–A/B campaigns, and peak private bytes were similar. I am not claiming a measured speedup, absence of leaks, or that this caused any Excel process termination. Invalid-pattern cleanup and arbitrary unsupported options remain separate pre-existing boundaries.

主要言語
VBA
スター
412
フォーク
70
平均マージ
1日 3時間
マージ済み PR(30日)
4

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sancarn/stdVBA のほかの issue

sancarn/stdVBA の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。