Additional rule condition operators for Magento 2 (matches regex, starts/ends with)
The extension must be installed via composer
. To proceed, run these commands in your terminal:
composer require blmage/magento2-rule-operators
php bin/magento module:enable BL_RuleOperators
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
This extension adds new operators (along with their negative variants):
to any rule condition based on Magento\Rule\Model\Condition\AbstractCondition
. This includes conditions from:
This is the same as the original “contains” operator, except that the searched value must be strictly located
respectively at the start or at the end of the tested value.
This performs a test based on a PCRE regular expression.
You can either supply:
^59\d{3}$
), which will applied with the i
(case insensitivity) and u
(UTF-8) modifiers./^59\d{3}$/D
), which will be used as-is.If you encounter a bug, or if you have a suggestion regarding a new operator, don’t hesitate to
post an issue!