Skip to content

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

@ekes

Description

@ekes

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions