Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Expression for exactly 16 Characters

Last post 09-04-2008, 11:55 AM by prometheuzz. 3 replies.
Sort Posts: Previous Next
  •  09-04-2008, 11:35 AM 45956

    Expression for exactly 16 Characters

    Hi all,

    I use the expression [A-Z0-9.'`\s]{1,16},

    To validate entry into a textbox

    This can't be empty so use 1,16 ie at least 1 char entered and Must be CAPS

    But I want to change the expression to check for EXACTLY 16 Characters..No More..No Less.

    What should I change the expression too?

    Thx,

    Ray..

  •  09-04-2008, 11:44 AM 45957 in reply to 45956

    Re: Expression for exactly 16 Characters

    Eh? Is this a trick question?

    Instead of {1,16} use {16}?

    Note that your current regex will also match a string that is made of only white spaces. Just so you know.

     HTH

  •  09-04-2008, 11:47 AM 45958 in reply to 45957

    Re: Expression for exactly 16 Characters

    Thx,

    I thought that myself but I wanted to make sure.

     

    Thanks again

    Mondo

  •  09-04-2008, 11:55 AM 45959 in reply to 45958

    Re: Expression for exactly 16 Characters

    Ah, okay.

    You're welcome, of course!

View as RSS news feed in XML