Skip to content

Human age verification regex matches empty string #231

@fabianegli

Description

@fabianegli

The regex in the human age verification

pattern: (?:^(?:\d+y)?(?:\d+m)?(?:\d+d)?$)|(?:not available)|(?:not applicable)

also matches the empty string and some entries with additional input like 'not applicable hoppla'.
See https://regex101.com/r/rTfGgC/5

I propose a the following regex instead

^(?:(?:\d+y)(?:\d+m)?(?:\d+d)?|(?:\d+y)?(?:\d+m)(?:\d+d)?|(?:\d+y)?(?:\d+m)?(?:\d+d)|(?:not available)|(?:not applicable))$

See https://regex101.com/r/rTfGgC/4

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