Skip to content

Form::PATTERN doesn't allow for case-insensitive checks #185

Description

@renekliment

Version: 2.4.x

Bug Description

Hi! I'm trying to perform a case-insensitive pattern validation using the Form::PATTERN form rule, but it seems the functionality isn't there.

  1. Both the PHP & JS code puts stuff before and after the regexp so using global modifiers is not possible. Moreover, JS doesn't support in-line regexp modifiers.
  2. It seems that Form::REGEXP used to exist in the past (but was removed) that could do this. Also, in netteForms.js, the handler function is still there.

Steps To Reproduce

$control->addRule(Form::PATTERN, 'Invalid file extension.', "(.*)\.(txt|md)");

Expected Behavior

To be able to use the i modifier. Or to be able to achieve the same behavior in a reasonable way.

Possible Solution

Not sure. I don't know the reason behind removing Form::REGEXP and it seems weird to me that people wouldn't want to use this. Do they write new validation rules instead?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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