javascript - Regex - match whole word in parsley.js -
how match 2 entire words or(|)
operand in parsley.js' data-parsley-pattern
attribute?
as can see want match words user
, moderator
.
i have tried: data-parsley-pattern="/(user|moderator)/"
normal regex , works other standardised regular expression matching regex101.com: https://regex101.com/r/kd7sr1/1
your pattern should work, long using full form /.../
, otherwise pattern anchored. don't need parenthesis won't hurt either.
here's working demo uses
<input data-parsley-pattern="/user|moderator/" type="text" name="fullname" required>
Comments
Post a Comment