diff --git a/strings.md b/strings.md index c5d425f6e4..ce8797bf68 100644 --- a/strings.md +++ b/strings.md @@ -72,6 +72,7 @@ Laravel includes a variety of functions for manipulating string values. Many of [Str::mask](#method-str-mask) [Str::match](#method-str-match) [Str::matchAll](#method-str-match-all) +[Str::isMatch](#method-str-is-match) [Str::orderedUuid](#method-str-ordered-uuid) [Str::padBoth](#method-str-padboth) [Str::padLeft](#method-str-padleft) @@ -1084,6 +1085,23 @@ $result = Str::matchAll('/f(\w*)/', 'bar fun bar fly'); If no matches are found, an empty collection will be returned. + +#### `Str::isMatch()` {.collection-method} + +The `Str::isMatch` method will return `true` if the string matches a given regular expression: + +```php +use Illuminate\Support\Str; + +$result = Str::isMatch('/foo (.*)/', 'foo bar'); + +// true + +$result = Str::isMatch('/foo (.*)/', 'laravel'); + +// false +``` + #### `Str::orderedUuid()` {.collection-method}