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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -