Skip to content

[Validator] add html pattern option to regex constraint #2833

Closed
@1ed

Description

@1ed

Hi!

A new htmlPattern option was added (by this commit symfony/symfony@6f9eda9 so it exists since 2.1) to the Regex constraint and it's not in the docs.

And there is a pitfall (thats why this option exists) that I think the doc should mention... php's PCRE patterns are not fully compatible with the pattern HTML5 attribute e.g. JavaScript does not support \A and \Z anchors so you're stuck with using the caret (^) and dollar ($) for this purpose.

And one more thing from this commit symfony/symfony@7503ec9

Pattern is also ignored if match=false since the pattern should then be reversed before application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionableClear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions