Skip to content

pooley182/emoji-regex-pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

emoji-regex-pattern

This package for PHP builds a regex pattern that will match any emojis as defined by the Unicode consortium. It's especially useful when validating user submitted data if you want to remove emojis to sanitise your data.

versioning

This package does not follow typical symantic versioning rules. Typical version numbering would follow the convention X.Y.Z where X is a major version which denotes breaking changes in the package, Y would be a minor version that introduces new features but doesn't break anything, and Z would be a patch version that fixes up some code without any major changes or new features.

The version numbers of this package follow the versioning numbers of the Unicode Consortiums Emojis. V14.0 of this package will match all emojis within the consortiums V14.0 Emoji set. V15.0 of this package matches the consortiums V15.0 set of emojis. etc.

Therefore we recommend installing this package with composer require pooley182/emoji-regex-pattern ">=14.0.2", this will mean that as new emoji character sets are released your composer package will be updated to match them.

How to use

Install

composer require pooley182/emoji-regex-pattern ">=14.0.2"

Usage

use Pooley182\EmojiRegexPattern\EmojiRegexPattern;

private function hasEmojis($string) {
    $emojiRegexPattern = '/'.EmojiRegexPattern::getEmojiPattern().'/u';

    preg_match($emojiRegexPattern, $string, $matches);

    return !empty($matches);
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages