preg_match で名前付きサブパターンを使用して、配列内の行に名前を付けることができることを知っています: (?P<sval1>[\w-]+)
. これに関する問題は、「sval1」が事前定義されていることです。この名前付きサブパターンを正規表現ルックアップ自体の一部として作成することは可能ですか?
たとえば、テキスト フィールドが次のような場合:
step=5
min=0
max=100
基本的に、preg_match を使用して配列を作成したいと思います。
{
[step] => 5
[min] => 0
[max] => 100
}
ユーザーは、テキスト エントリに好きなだけフィールドを追加できます。そのため、入力に基づいて配列エントリを動的に生成する必要があります。これを行う簡単な方法はありますか?