Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567



Regex Helpers for Laravel | Laravel News

hotmeteor/regex is a set of ready-made regex helper methods for use in your Laravel application:

This package comes with common regular expression patterns that are ready to match and replace against values. The package supports case-insensitivity, Unicode characters and supports all languages.

Here are some examples from the package’s readme:

1// Match

2Regex::isAlpha($subject, $allowWhitespace = false);

3Regex::isAlphanumeric($subject, $allowWhitespace = false);

4Regex::isAlphadash($subject, $allowWhitespace = false);

5Regex::isDigits($subject, $allowWhitespace = false);



8// Replace

9Regex::alpha($subject, $replace = '');

10Regex::alphanumeric($subject, $replace = '');

11Regex::alphadash($subject, $replace = '');

12Regex::digits($subject, $replace = '');

13Regex::numeric($subject, $replace = '');

You also have access to the underlying match and replace methods for custom patterns:

1// Replace interface

2public static function replace($subject, $pattern, $replacement = '');


4// Match interface

5public static function match($subject, $pattern, bool $allowWhitespace = false): bool;

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

Credit: Source link

Previous Next
Test Caption
Test Description goes like this