optional characters in javascript regular expression
Posted
by Anthony
on Stack Overflow
See other posts from Stack Overflow
or by Anthony
Published on 2010-05-04T21:19:08Z
Indexed on
2010/05/04
21:28 UTC
Read the original article
Hit count: 201
JavaScript
|regex
I am trying to build a regular expression in javascript that checks for 3 word characters however 2 of them are are optional. So I have:
/^\w\w\w/i
what I am stumped on is how to make it that the user does not have to enter the last two letters but if they do they have to be letters
© Stack Overflow or respective owner