• Reading time ~ 1 min
  • 24.08.2022

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:

// Match
Regex::isAlpha($subject, $allowWhitespace = false);
Regex::isAlphanumeric($subject, $allowWhitespace = false);
Regex::isAlphadash($subject, $allowWhitespace = false);
Regex::isDigits($subject, $allowWhitespace = false);
Regex::isNumeric($subject);
 
// Replace
Regex::alpha($subject, $replace = '');
Regex::alphanumeric($subject, $replace = '');
Regex::alphadash($subject, $replace = '');
Regex::digits($subject, $replace = '');
Regex::numeric($subject, $replace = '');

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

// Replace interface
public static function replace($subject, $pattern, $replacement = '');
 
// Match interface
public 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.

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

ABOUT

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

About author CrazyBoy49z
WORK EXPERIENCE
Contact
Ukraine, Lutsk
+380979856297