Skip to content

Support lookahead-based length checking #5

@skeate

Description

@skeate

In Javascript regex, you can enforce a string of a certain length, even across different terms, with a lookahead operator. For example, /^(?=.{5}$)a*b*$/ matches any number of 'a's followed by any number of 'b's, as long as there are five total, so the following strings match:

aaaaa
aaaab
aaabb
aabbb
abbbb
bbbbb

This can be useful for this library, for example with an email address, the total length of the domain part must be at most 255 characters, but it has further constraints within those 255 characters (for example, each label in the domain must be at most 63 characters)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions