正規表現によるマッチングを行います。
preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] ) |
$pattern で指定した正規表現により $subject を検索します。
引数 | 説明 |
$pattern | 検索するパターンを表す文字列。 |
$subject | 入力文字列。 |
[$matches] | 変数を指定した場合、検索結果が代入されます。なお、$matches[0] にはパターン全体にマッチしたテキストが代入され、$matches[1] には1番目のキャプチャ用サブパターンにマッチした文字列が代入されます(以後同様)。 |
[$flags] | ----- |
[$offset] | ----- |
preg_match('/^([0-9]*)$/', $subject, $matches)