Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostalCodeHelper::match() doesn't accept operator modifiers on regular expressions #164

Open
ekes opened this issue Feb 11, 2022 · 0 comments

Comments

@ekes
Copy link

ekes commented Feb 11, 2022

Example:

PostalCodeHelper::match('ze1 1aa', '', '/ZE[0-9]/i') won't work because

if (substr($rule, 0, 1) == '/' && substr($rule, -1, 1) == '/') {
checks for a regex beginning with / and ending with /.

The only solution I can think of at the moment is to change to:

        $match = preg_match($rule, $postalCode);
        if ($match === FALSE) {
            $match = in_array($postalCode, self::buildList($rule));
        }

Don't know if that would be acceptable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant