-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
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
Labels
No labels