1 Reply Latest reply on Sep 1, 2009 12:06 PM by ShardulSingh

    Use RegEx to check for whitespace


      I have the following RegEx that checks for 1) string between 12 and 35 characters in length, 2) string contains at least one digit, 3) string contains at least one lowercase alpha character, 4) string contains at least one uppercase alpha character, 5) string contains one special character.




      The only thing else I need to add is a check for any whitespace characters anywhere in the string.  I tried the following but it allowed whitespace in the string:




      Could someone advise where I am going wrong with this?



        • 1. Re: Use RegEx to check for whitespace
          ShardulSingh Level 3


          I don’t have your complete code.But I am giving you as a demo code,

          In this I have not allowed the white space so white space is not being

          Allowed on the textbox.Hope this will help you.Please let me know if you have any issue with this.





          <?xml version="1.0" encoding="utf-8"?>

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">




                private var regExpForFile : String

                = "0-9A-Za-z\\&\\`\\~\\!\\@\\#\\$\\%\\^\\(\\)\\-\\_\\=\\+\\]\\}\[\\'\\;\\,\\.\\{";



                <mx:VBox horizontalAlign="center" width="350">

                      <mx:Label text="Enter File Name"/>

                      <mx:TextInput id="fileName" width="170" height="20"  restrict="{regExpForFile}"/>












          With Regards,


          Shardul Singh Bartwal