阅读(2537) (6)

Laravel 8 match {#collection-method}

2021-07-05 09:43:50 更新

match 方法将会返回字符串和指定正则表达式匹配的部分:

use IlluminateSupportStr;

$result = Str::of('foo bar')->match('/bar/');

// 'bar'

$result = Str::of('foo bar')->match('/foo (.*)/');

// 'bar'