<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Password Validation via Regular Expression</title>
	<atom:link href="http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/feed/" rel="self" type="application/rss+xml" />
	<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/</link>
	<description>Articles of .NET,MCMS, C#, SQL Server, HTML/DHTML/CSS and somethnig about me</description>
	<lastBuildDate>Thu, 26 Nov 2009 08:43:10 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: dan</title>
		<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-1012</link>
		<dc:creator>dan</dc:creator>
		<pubDate>Thu, 26 Nov 2009 08:43:10 +0000</pubDate>
		<guid isPermaLink="false">http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-1012</guid>
		<description>I think a found a little flaw in the last regex. This regex allows to put !any! character at the end of the string, regardless of what you defined as valid characters.

Test it against 0123456789aA+* and you will see.

I also think the leading .* can be dismissed since it present in all positive lookaheads. The last .* is the source of the flaw since it allows any character to follow the valid characters.</description>
		<content:encoded><![CDATA[<p>I think a found a little flaw in the last regex. This regex allows to put !any! character at the end of the string, regardless of what you defined as valid characters.</p>
<p>Test it against 0123456789aA+* and you will see.</p>
<p>I also think the leading .* can be dismissed since it present in all positive lookaheads. The last .* is the source of the flaw since it allows any character to follow the valid characters.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shallu tagra</title>
		<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-1006</link>
		<dc:creator>Shallu tagra</dc:creator>
		<pubDate>Wed, 07 Oct 2009 06:13:57 +0000</pubDate>
		<guid isPermaLink="false">http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-1006</guid>
		<description>All expressions work well with Java reqular expression library and however these do not seem to be working with Apache library . Trying to use the below and gives me an error - &quot;Syntax error: Missing operand to closure&quot;

Expression used:
^.*(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;]).*$

Having looked at it again ...seems like Apache doesnt accept characters like &quot;?&quot; , not sure what could be the replacement for the same and if there is none then the expression would be difficult to be written and understood by anyone at later stage as to check for 4 conditions in expression upper alpha , lower alpha , numeric and special characters string of expression will become too lengthy.</description>
		<content:encoded><![CDATA[<p>All expressions work well with Java reqular expression library and however these do not seem to be working with Apache library . Trying to use the below and gives me an error &#8211; &#8220;Syntax error: Missing operand to closure&#8221;</p>
<p>Expression used:<br />
^.*(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;]).*$</p>
<p>Having looked at it again &#8230;seems like Apache doesnt accept characters like &#8220;?&#8221; , not sure what could be the replacement for the same and if there is none then the expression would be difficult to be written and understood by anyone at later stage as to check for 4 conditions in expression upper alpha , lower alpha , numeric and special characters string of expression will become too lengthy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shallu tagra</title>
		<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-1005</link>
		<dc:creator>Shallu tagra</dc:creator>
		<pubDate>Wed, 07 Oct 2009 05:45:28 +0000</pubDate>
		<guid isPermaLink="false">http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-1005</guid>
		<description>All expressions work well with Java reqular expression library and however these do not seem to be working with Apache library . Trying to use the below and gives me an error - &quot;Syntax error: Missing operand to closure&quot;

Expression used:
^.*(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;]).*$</description>
		<content:encoded><![CDATA[<p>All expressions work well with Java reqular expression library and however these do not seem to be working with Apache library . Trying to use the below and gives me an error &#8211; &#8220;Syntax error: Missing operand to closure&#8221;</p>
<p>Expression used:<br />
^.*(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;]).*$</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fozzy</title>
		<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-1004</link>
		<dc:creator>Fozzy</dc:creator>
		<pubDate>Tue, 29 Sep 2009 17:01:37 +0000</pubDate>
		<guid isPermaLink="false">http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-1004</guid>
		<description>I&#039;m doing this on PHP 5 and it appears that the starting &quot;.*&quot; in expression three is redundant and can be eliminated (at least, I did and it works fine).

^(?=.{10,32})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%*^&amp;(){}]).*$

Analyzing this, you basically can pull the &quot;atoms&quot; out and you can see this...

^.*$

Which reads &quot;accept any number of characters&quot;.

Putting the atoms back states that the string must meet the &quot;atom&quot; criteria.  For example, if we just wanted to limit the size we use the size &quot;atom&quot;.

^(?=.{10,32}).*$

&quot;Accept between 10 and 32 characters of any type.&quot;

If you wanted to make sure it also had at least 1 digit:

^(?=.{10,32})(?=.*\d).*$

&quot;Accept between 10 and 32 characters and must have any number of digits.&quot;

Now, we simply don&#039;t care how many digits they use. If you only wanted them to use a specific number of digits, you&#039;d have to change the (.*) portion of the digit &quot;atom&quot;.  As an example, lets limit it to between 2 and 4 digits:

^(?=.{10,32})(?=\d{2,4}).*$

In this case, we can keep building up what your password Regex criteria is.

If you wanted to allow the user to pick 2 or 3 of the 4 criteria such as:

&quot;Your password must contain at least 3 of the following criteria: Upper-case, Lower-case, Number, and special character&quot;

You need to use the or (&#124;) and build up all the possible combination.  Allowing any 3 of the 4 criteria would create:

^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$
&#124;
^(?=.*\d)(?=.*[a-z])(?=.*[@#$%^&amp;+=]).*$
&#124;
^(?=.*\d)(?=.*[A-Z])(?=.*[@#$%^&amp;+=]).*$
&#124;
^(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;+=]).*$

(There&#039;s no limit to size, but clearly the password has to be at least 3 characters long since it has to have at least 3 unique characters in the string)

Another issue you might see is that it allows ANY character (Nulls, Newlines, etc) in the string as long as AT LEAST the criteria characters at met.  

Meaning, you can have:

 &quot;aB3{space}{newline}{etc..}&quot; 

and it will still be accepted.  To limit what characters you string can contain to be only the characters listed in your criteria (alpha-numeric and the listed special characters) you have to edit the (.*) to be the list of characters you want to accept such as ([a-zA-Z0-9@#$%^+=]*).

Taking the &quot;atoms&quot; out, you will have a base Regex like this:

^[a-zA-Z0-9@#$%^+=]*$

Simply add in the &quot;Atoms&quot; you want for criteria back in.  Here&#039;s what I use:

&quot;Require 3 of 4 criteria of: upper-case, lower-case, number, or the following special characters (@#$%^+=).  No other characters are allowed.&quot;

^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9@#$%^&amp;+=]*$
&#124;
^(?=.*\d)(?=.*[a-z])(?=.*[@#$%^&amp;+=])[a-zA-Z0-9@#$%^&amp;+=]*$
&#124;
^(?=.*\d)(?=.*[A-Z])(?=.*[@#$%^&amp;+=])[a-zA-Z0-9@#$%^&amp;+=]*$
&#124;
^(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;+=])[a-zA-Z0-9@#$%^&amp;+=]*$

Add/remove special characters or &quot;atoms&quot; as you need.</description>
		<content:encoded><![CDATA[<p>I&#8217;m doing this on PHP 5 and it appears that the starting &#8220;.*&#8221; in expression three is redundant and can be eliminated (at least, I did and it works fine).</p>
<p>^(?=.{10,32})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%*^&amp;(){}]).*$</p>
<p>Analyzing this, you basically can pull the &#8220;atoms&#8221; out and you can see this&#8230;</p>
<p>^.*$</p>
<p>Which reads &#8220;accept any number of characters&#8221;.</p>
<p>Putting the atoms back states that the string must meet the &#8220;atom&#8221; criteria.  For example, if we just wanted to limit the size we use the size &#8220;atom&#8221;.</p>
<p>^(?=.{10,32}).*$</p>
<p>&#8220;Accept between 10 and 32 characters of any type.&#8221;</p>
<p>If you wanted to make sure it also had at least 1 digit:</p>
<p>^(?=.{10,32})(?=.*\d).*$</p>
<p>&#8220;Accept between 10 and 32 characters and must have any number of digits.&#8221;</p>
<p>Now, we simply don&#8217;t care how many digits they use. If you only wanted them to use a specific number of digits, you&#8217;d have to change the (.*) portion of the digit &#8220;atom&#8221;.  As an example, lets limit it to between 2 and 4 digits:</p>
<p>^(?=.{10,32})(?=\d{2,4}).*$</p>
<p>In this case, we can keep building up what your password Regex criteria is.</p>
<p>If you wanted to allow the user to pick 2 or 3 of the 4 criteria such as:</p>
<p>&#8220;Your password must contain at least 3 of the following criteria: Upper-case, Lower-case, Number, and special character&#8221;</p>
<p>You need to use the or (|) and build up all the possible combination.  Allowing any 3 of the 4 criteria would create:</p>
<p>^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$<br />
|<br />
^(?=.*\d)(?=.*[a-z])(?=.*[@#$%^&amp;+=]).*$<br />
|<br />
^(?=.*\d)(?=.*[A-Z])(?=.*[@#$%^&amp;+=]).*$<br />
|<br />
^(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;+=]).*$</p>
<p>(There&#8217;s no limit to size, but clearly the password has to be at least 3 characters long since it has to have at least 3 unique characters in the string)</p>
<p>Another issue you might see is that it allows ANY character (Nulls, Newlines, etc) in the string as long as AT LEAST the criteria characters at met.  </p>
<p>Meaning, you can have:</p>
<p> &#8220;aB3{space}{newline}{etc..}&#8221; </p>
<p>and it will still be accepted.  To limit what characters you string can contain to be only the characters listed in your criteria (alpha-numeric and the listed special characters) you have to edit the (.*) to be the list of characters you want to accept such as ([a-zA-Z0-9@#$%^+=]*).</p>
<p>Taking the &#8220;atoms&#8221; out, you will have a base Regex like this:</p>
<p>^[a-zA-Z0-9@#$%^+=]*$</p>
<p>Simply add in the &#8220;Atoms&#8221; you want for criteria back in.  Here&#8217;s what I use:</p>
<p>&#8220;Require 3 of 4 criteria of: upper-case, lower-case, number, or the following special characters (@#$%^+=).  No other characters are allowed.&#8221;</p>
<p>^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9@#$%^&amp;+=]*$<br />
|<br />
^(?=.*\d)(?=.*[a-z])(?=.*[@#$%^&amp;+=])[a-zA-Z0-9@#$%^&amp;+=]*$<br />
|<br />
^(?=.*\d)(?=.*[A-Z])(?=.*[@#$%^&amp;+=])[a-zA-Z0-9@#$%^&amp;+=]*$<br />
|<br />
^(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;+=])[a-zA-Z0-9@#$%^&amp;+=]*$</p>
<p>Add/remove special characters or &#8220;atoms&#8221; as you need.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pam</title>
		<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-991</link>
		<dc:creator>pam</dc:creator>
		<pubDate>Thu, 06 Aug 2009 15:59:03 +0000</pubDate>
		<guid isPermaLink="false">http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-991</guid>
		<description>Very useful ! Thanks</description>
		<content:encoded><![CDATA[<p>Very useful ! Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mohammed rehan rizvi</title>
		<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-990</link>
		<dc:creator>mohammed rehan rizvi</dc:creator>
		<pubDate>Thu, 30 Jul 2009 05:35:04 +0000</pubDate>
		<guid isPermaLink="false">http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-990</guid>
		<description>Pretty useful. Nice and easy</description>
		<content:encoded><![CDATA[<p>Pretty useful. Nice and easy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alps</title>
		<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-989</link>
		<dc:creator>Alps</dc:creator>
		<pubDate>Wed, 29 Jul 2009 04:44:31 +0000</pubDate>
		<guid isPermaLink="false">http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-989</guid>
		<description>easy to understand !
thnx</description>
		<content:encoded><![CDATA[<p>easy to understand !<br />
thnx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ion Drimba</title>
		<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-987</link>
		<dc:creator>Ion Drimba</dc:creator>
		<pubDate>Sat, 11 Jul 2009 21:41:29 +0000</pubDate>
		<guid isPermaLink="false">http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-987</guid>
		<description>Hi Nilang,

My name is Ion Drimba and I´m a flash developer from Brazil.
I ´m wondering if it´s possible to built a regular expression for this scenario:

min 1 number max 8 and
min 1 alphanumeric max 2.
The order doesn&#039;t matter.

It is possible or am I trying to do something that regular expression doesn´t support?

Thanks Ion Drimba</description>
		<content:encoded><![CDATA[<p>Hi Nilang,</p>
<p>My name is Ion Drimba and I´m a flash developer from Brazil.<br />
I ´m wondering if it´s possible to built a regular expression for this scenario:</p>
<p>min 1 number max 8 and<br />
min 1 alphanumeric max 2.<br />
The order doesn&#8217;t matter.</p>
<p>It is possible or am I trying to do something that regular expression doesn´t support?</p>
<p>Thanks Ion Drimba</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How to Get Six Pack Fast</title>
		<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-946</link>
		<dc:creator>How to Get Six Pack Fast</dc:creator>
		<pubDate>Wed, 15 Apr 2009 15:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-946</guid>
		<description>This topic is quite hot in the net at the moment. What do you pay   attention to when choosing what to write about?</description>
		<content:encoded><![CDATA[<p>This topic is quite hot in the net at the moment. What do you pay   attention to when choosing what to write about?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hardik</title>
		<link>http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-943</link>
		<dc:creator>Hardik</dc:creator>
		<pubDate>Sat, 11 Apr 2009 07:11:55 +0000</pubDate>
		<guid isPermaLink="false">http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/#comment-943</guid>
		<description>superb !
Thnks</description>
		<content:encoded><![CDATA[<p>superb !<br />
Thnks</p>
]]></content:encoded>
	</item>
</channel>
</rss>
