5 Replies Latest reply on Oct 4, 2011 7:34 AM by ACS LLC

    Help with REGEX to block invalid characters

    ACS LLC Level 1

      I have a regex that is used to block unusual characters from being entered into a user name, so they can put pipes etc in there, I just want 0-9 and a-z (upper or lowercase), but I just noticed that it's not working. I am not up to speed on regex, I took this from somewhere else


      here is the expression:


      <cfif len(trim(ReReplaceNocase(form_username, '^[A-Za-z][A-Za-z0-9_]*', '', 'ALL'))) gt 0>


      It is failing when I enter 2kljlkll3456 as the username


      Anybody have any idea why it's not working?


      After posing this I found out that the issue is that it does not allo me to have a username that starts with a number, only a letter, anybody have any idea how to fix that?