ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2017 www.aspforums.com. All rights reserved.Validate PAN number in ASP.Net TextBox using Regular Expression<p>I have a textBox that will accept Pan number.</p> <p>Please tell how to validate the text box,so that it will take only pan number..</p>http://www.aspforums.net/Threads/116803/Validate-PAN-number-in-ASPNet-TextBox-using-Regular-Expression/http://www.aspforums.net/Threads/116803/Validate-PAN-number-in-ASPNet-TextBox-using-Regular-Expression/Tue, 11 Nov 2014 04:25:22 GMTValidate IpAddress using Regular Expressions (Regex) in ASP.Net<p>Hi,</p> <p>How to write validation for IpAddress in asp.net.</p>http://www.aspforums.net/Threads/184457/Validate-IpAddress-using-Regular-Expressions-Regex-in-ASPNet/http://www.aspforums.net/Threads/184457/Validate-IpAddress-using-Regular-Expressions-Regex-in-ASPNet/Tue, 09 Sep 2014 07:37:50 GMTValidate Http and Https Url using RegularExpression (Regex) in JavaScript<p>I need to implement URL Validation using Javascript in MVC4. Here is my code .</p> <pre class="brush: csharp">var regexp = &#34;^http(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\&#39;\/\\\+&amp;amp;%\$#_]*)?$&#34;; return regexp.test(URLValue);</pre> <p>but its not working in MVC 4. i thought test operation is not supported for MVC. Is there any solution to implement validation using Javascript.</p> <p>&nbsp;</p>http://www.aspforums.net/Threads/101081/Validate-Http-and-Https-Url-using-RegularExpression-Regex-in-JavaScript/http://www.aspforums.net/Threads/101081/Validate-Http-and-Https-Url-using-RegularExpression-Regex-in-JavaScript/Sun, 16 Mar 2014 23:18:33 GMTToggle Multiple RegularExpression Validators for one TextBox based on RadioButton selection in ASP.Net<div class="post-text"> <p>I have a RadioButtonList that includes three values: - UPC - Description - ItemCode</p> <p>UPC can only allow numbers (0-9). Description can allow any text. ItemCode only allows numbers or letters.</p> <p>I have a textbox (txtbox_reportBy).</p> <p>Is there a way to setup three types of validators all for the same textbox based on which radiobutton value is selected?</p> <p>i.e. If UPC is selected, then the textbox's validator should only allow numbers. If Description is selected, then the textbox's validator probably don't have to validate anything. If ItemCode is selected, then the textbox's validator should only allow numbers or letters.</p> <p>Thanks.</p> </div>http://www.aspforums.net/Threads/885274/Toggle-Multiple-RegularExpression-Validators-for-one-TextBox-based-on-RadioButton-selection-in-ASPNet/http://www.aspforums.net/Threads/885274/Toggle-Multiple-RegularExpression-Validators-for-one-TextBox-based-on-RadioButton-selection-in-ASPNet/Wed, 24 Sep 2014 02:27:18 GMTRegularExpression to check whether ZipCode (PinCode) exists or not<p>Sir,</p> <p>Is there any regular expression validator to find that entered pincode really exists or not (<strong>without checking format of pincode</strong>).</p> <p><strong>OR</strong></p> <p>Any any other way to do this?.............</p> <p>&nbsp;</p>http://www.aspforums.net/Threads/769634/RegularExpression-to-check-whether-ZipCode-PinCode-exists-or-not/http://www.aspforums.net/Threads/769634/RegularExpression-to-check-whether-ZipCode-PinCode-exists-or-not/Wed, 15 Oct 2014 06:07:17 GMTRegular expression to have combination of UpperCase and LowerCase Alphabets<p>Hi,</p> <p>I have to apply a validation to accept only combination of Upper and Lower case to textbox but not either complete lower or complete upper or anything else.&nbsp;</p> <p>I am using below code but it allows complete upper and complete lower.<span style="font-size: 9pt;">&nbsp;</span></p> <p>Please help to get this resolved.<span style="font-size: 9pt;">&nbsp;</span></p> <p>Thanks,</p> <p>Vidya</p> <pre class="brush: xml">&lt;asp:Content ID=&#34;BodyContent&#34; runat=&#34;server&#34; ContentPlaceHolderID=&#34;MainContent&#34;&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;First Name:&lt;/td&gt; &lt;td&gt;&lt;asp:TextBox ID=&#34;txtFirstname&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt;&lt;/td&gt; &lt;td&gt;&lt;asp:RegularExpressionValidator ID=&#34;revFirstName&#34; runat=&#34;server&#34; ControlToValidate=&#34;txtFirstname&#34; ValidationExpression=&#34;^[a-zA-Z]+$&#34; ErrorMessage=&#34;Only combination of Upper and lower allowed&#34; Display=&#34;Dynamic&#34;&gt; &lt;/asp:RegularExpressionValidator&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;asp:Button ID=&#34;cmdSubmit&#34; runat=&#34;server&#34; Text=&#34;Submit&#34; /&gt; &lt;/asp:Content&gt;</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/294492/Regular-expression-to-have-combination-of-UpperCase-and-LowerCase-Alphabets/http://www.aspforums.net/Threads/294492/Regular-expression-to-have-combination-of-UpperCase-and-LowerCase-Alphabets/Mon, 18 Nov 2013 03:03:10 GMTRegular Expression that matches anything after space in C# .Net<p>i have a string like</p> <p>str="arun vijay"</p> <p>&nbsp;</p> <p>i want only vijay..can anyone tel the regex for this&nbsp;</p>http://www.aspforums.net/Threads/146452/Regular-Expression-that-matches-anything-after-space-in-C-Net/http://www.aspforums.net/Threads/146452/Regular-Expression-that-matches-anything-after-space-in-C-Net/Tue, 18 Jun 2013 04:38:45 GMTRemove and replace Plus (+) character with space using RegularExpression (Regex) and JavaScript<p>&nbsp;</p> <pre class="brush: js">&lt;script type=&#34;text/javascript&#34;&gt; $(document).ready(function () { $.ajax({ type: &#34;POST&#34;, contentType: &#34;application/json; charset=utf-8&#34;, url: &#34;/Default.aspx/Spotlight&#34;, data: &#39;{}&#39;, dataType: &#34;json&#34;, success: function (data) { var myobject = JSON.stringify(data.d); $($.parseJSON(myobject)).each(function (index, el) { $(&#39;.titleofpost&#39;).text(el.post_title).replace(&#39;/+/g&#39;, &#39; &#39;); $(&#39;.titleofpost&#39;).attr(&#39;href&#39;, el.post_title); $(&#39;.appendspotlight&#39;).text(el.post_description); // document.write(el.post_title,el.post_date, el.post_credit, el.post_description, el.post_views); }); }, error: OnError }); }); } &lt;/script&gt;</pre> <p>&nbsp;</p> <pre class="brush: csharp">[ScriptMethod(ResponseFormat = ResponseFormat.Json)] [WebMethod] public static List&lt;Posts&gt; Spotlight() { string query = &#34;select TOP 1 post_date,post_tags,post_title,post_credit,post_id,post_description,post_views,post_image,post_know from posts where post_highlited=1&#34;; SqlCommand cmd = new SqlCommand(query); DataSet ds = GetData(cmd); DataTable dt = ds.Tables[0]; foreach (DataRow item in ds.Tables[0].Rows) { Posts post = new Posts(); post.post_title = HttpUtility.UrlEncode(item[&#34;post_title&#34;].ToString()); post.post_credit = item[&#34;post_credit&#34;].ToString(); post.post_date = String.Format(&#34;{0:ddd, MMM d, yyyy}&#34;, item[&#34;post_date&#34;]); post.post_description = item[&#34;post_description&#34;].ToString(); post.post_know = item[&#34;post_know&#34;].ToString(); post.post_views = Convert.ToInt16(item[&#34;post_views&#34;]); productt.Add(post); } return productt; }</pre> <p>I am getting json value for post_title in this format</p> <p>since i am using httputility.urlencode</p> <h2><a class="titleofpost" href="http://localhost:13607/Default.aspx#">Why+every+One+Should+Blog</a></h2> <p>I want to remove + and make it look like&nbsp;</p> <h2><a class="titleofpost" href="http://localhost:13607/Default.aspx#">Why every One Should Blog</a></h2> <p>&nbsp;</p>http://www.aspforums.net/Threads/171714/Remove-and-replace-Plus-character-with-space-using-RegularExpression-Regex-and-JavaScript/http://www.aspforums.net/Threads/171714/Remove-and-replace-Plus-character-with-space-using-RegularExpression-Regex-and-JavaScript/Mon, 21 Sep 2015 03:28:30 GMTRegularExpression Validator (Regex) to check whether string has Dot and Hyphen ASP.Net<p>I have a textbox,I want to validate it to contain alphabets and hypen and dot for Inserting name..</p> <p>ex for:Dr. HAMID-ULLAL</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</p> <pre class="brush: html">@Html.TextBoxFor(m =&gt; m.FirstName, new { @class = &#34;form-control validate[required,custom[onlyLetterSQ]]&#34;, @id = &#34;firstName&#34; })</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/183398/RegularExpression-Validator-Regex-to-check-whether-string-has-Dot-and-Hyphen-ASPNet/http://www.aspforums.net/Threads/183398/RegularExpression-Validator-Regex-to-check-whether-string-has-Dot-and-Hyphen-ASPNet/Mon, 20 Jul 2015 02:22:10 GMTRegularExpression Validator (Regex) to check valid HTTP, HTTPS and FTP URLs in ASP.Net<p>Hi ! this is my regular expression which i am using for url :</p> <pre class="brush: csharp">^((http|https|ftp)://)?(([\w-]+\.)+[^#?\s]+)(.*)?(#[\w\-]+)?$</pre> <p>Now it is allowing comma , i dont want to allow comma in it . Kindly help</p>http://www.aspforums.net/Threads/128643/RegularExpression-Validator-Regex-to-check-valid-HTTP-HTTPS-and-FTP-URLs-in-ASPNet/http://www.aspforums.net/Threads/128643/RegularExpression-Validator-Regex-to-check-valid-HTTP-HTTPS-and-FTP-URLs-in-ASPNet/Tue, 18 Aug 2015 08:40:14 GMTRegular Expression For Double Extension Check ASP.NET<p>Sir,</p> <p>&nbsp;I have to made a regular expression for <strong>double extension</strong> check for Fileupload control.</p> <p>The valid type of file is <strong>7.pdf</strong> and it should not allow to upload <strong>7.PHP.pdf</strong></p> <p>I have checked an article as below</p> <p><a href="http://www.aspsnippets.com/Articles/Validate-FileUpload-Control-using-Regular-Expression-and-RegularExpression-Validator-in-ASPNet.aspx">http://www.aspsnippets.com/Articles/Validate-FileUpload-Control-using-Regular-Expression-and-RegularExpression-Validator-in-ASPNet.aspx</a></p> <p>there the first regular expression is for PDF files and it's working to upload only pdf, But i would need to check double extension. How should i achieve this ?</p> <p>Kindly suggest the suggestion.</p>http://www.aspforums.net/Threads/168803/Regular-Expression-For-Double-Extension-Check-ASPNET/http://www.aspforums.net/Threads/168803/Regular-Expression-For-Double-Extension-Check-ASPNET/Tue, 14 Feb 2017 01:03:39 GMTRegular Expression for Alphabets in sequence followed by Digits (Numbers)<p>i wanted the validation expression for id field. this field is such that it should contain the initial 3 upperspace characters and the next 7 as digits.</p> <p>ex- DFG5667878,DSF2465789.</p>http://www.aspforums.net/Threads/140291/Regular-Expression-for-Alphabets-in-sequence-followed-by-Digits-Numbers/http://www.aspforums.net/Threads/140291/Regular-Expression-for-Alphabets-in-sequence-followed-by-Digits-Numbers/Wed, 15 Apr 2015 07:45:52 GMTRegular Expression - Minimum 5 characters with atleast one numeric character<p>how to limit the user to enter atleast 5 letters and &nbsp;atleast 1 number in text field.</p>http://www.aspforums.net/Threads/218172/Regular-Expression---Minimum-5-characters-with-atleast-one-numeric-character/http://www.aspforums.net/Threads/218172/Regular-Expression---Minimum-5-characters-with-atleast-one-numeric-character/Wed, 29 Aug 2012 03:13:31 GMTRegular Expression (Regex) for toll free number 1 800 ###-####<p>What is the regular expression for USA toll free number&nbsp;<code>1 800 ###-####</code>? How to validate this for phone using c#? i want the regular expression only</p>http://www.aspforums.net/Threads/193093/Regular-Expression-Regex-for-toll-free-number-1-800--/http://www.aspforums.net/Threads/193093/Regular-Expression-Regex-for-toll-free-number-1-800--/Mon, 04 Jan 2016 01:05:59 GMTRegular Expression (Regex) for Phone number with Country code and 10 digits<p>I need regular expression for</p> <p>1)<strong>Phone</strong></p> <p>like&nbsp;</p> <p>+919000000000 (country code)(10 digits)</p> <p>&nbsp;</p> <div class="GrayBar">&nbsp;</div> <p>&nbsp;</p>http://www.aspforums.net/Threads/163613/Regular-Expression-Regex-for-Phone-number-with-Country-code-and-10-digits/http://www.aspforums.net/Threads/163613/Regular-Expression-Regex-for-Phone-number-with-Country-code-and-10-digits/Tue, 18 Nov 2014 02:22:39 GMTRegular Expression (Regex) for number with two decimal points in ASP.Net RegularExpression Validator <p>Restricting input to textbox: allowing only numbers and after input number allow one dot and after dot allow two number.&nbsp;</p>http://www.aspforums.net/Threads/494278/Regular-Expression-Regex-for-number-with-two-decimal-points-in-ASPNet-RegularExpression-Validator/http://www.aspforums.net/Threads/494278/Regular-Expression-Regex-for-number-with-two-decimal-points-in-ASPNet-RegularExpression-Validator/Sat, 28 Jun 2014 00:22:19 GMTRegular Expression (Regex) for Alphabets with special characters only<p>&nbsp;</p> <p>hwwllo can any one explain me how to set regular expression for textbox that allows a to z,A to Z, special characters(, &nbsp; &nbsp;. &nbsp;#) ie comma dot and hash</p>http://www.aspforums.net/Threads/376655/Regular-Expression-Regex-for-Alphabets-with-special-characters-only/http://www.aspforums.net/Threads/376655/Regular-Expression-Regex-for-Alphabets-with-special-characters-only/Mon, 10 Nov 2014 03:31:36 GMTRegex: Minimum 8 Characters at least 1 UpperCase 1 LowerCase 1 number and 1 Special Character<p>i need code to check the password policy using javascript for my change password page&nbsp;</p> <p>and the password policy should :</p> <p>length of password :10-12<br />min 1 uppaercase <br />min 1 lowercase<br />min 1 special char<br />and min 1 integer<br /><br />please reply soon.....&nbsp;</p>http://www.aspforums.net/Threads/186101/Regex-Minimum-8-Characters-at-least-1-UpperCase-1-LowerCase-1-number-and-1-Special-Character/http://www.aspforums.net/Threads/186101/Regex-Minimum-8-Characters-at-least-1-UpperCase-1-LowerCase-1-number-and-1-Special-Character/Tue, 04 Jun 2013 05:08:09 GMTImplement dynamic Password Policy from database using RegularExpression Validator in ASP.Net<p>I had implemented <strong>Password Policy</strong> in which user should enter <span style="color: #0000ff;">atleast 8 character of password</span> with below complexity while setting password:</p> <p>1 capital/Uppercase character , 1 special character and 1 number</p> <p><strong>I tried below code for above:</strong></p> <pre class="brush: html">&lt;asp:TextBox ID=&#34;passwordtxt&#34; runat=&#34;server&#34; Width=&#34;100%&#34; TextMode=&#34;Password&#34; MaxLength=&#34;10&#34;&gt;&lt;/asp:TextBox&gt; &lt;asp:RegularExpressionValidator ID=&#34;Regex1&#34; runat=&#34;server&#34; ControlToValidate=&#34;passwordtxt&#34; ValidationExpression=&#34;^(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*#?&amp;])[A-Za-z\d$@$!%*#?&amp;]{8,}$&#34; ErrorMessage=&#34;Password must contain: Minimum 8 characters with atleast 1 Uppercase letter, 1 special character and 1 Number&#34; ForeColor=&#34;Red&#34; /&gt;</pre> <p>by referring below article:<br /><br /><a href="http://www.aspsnippets.com/Articles/Implement-Password-Policy-using-Regular-Expressions-and-ASPNet-RegularExpression-Validator.aspx">http://www.aspsnippets.com/Articles/Implement-Password-Policy-using-Regular-Expressions-and-ASPNet-RegularExpression-Validator.aspx</a></p> <p>But in this code, I have to follow that:</p> <p>while entering password if it is below 8 character, then msg should come "password should be atleast 8 characters"<br />and after entering password, when user tries to save password, and if password is missing any of the complexity i.e., 1 capital/Uppercase character , 1 special character and 1 number,</p> <p>then msg should come "password should have 1 capital/Uppercase character , 1 special character and 1 number".</p> <p>Also, this complexity feature <strong>should be configurable in Database table</strong>.<br />If enabled, then enter complex password<br />If disabled, then only 8 charatcter password with no cpmlexity</p> <p>&nbsp;</p> <p>Please reply how to achieve that.</p>http://www.aspforums.net/Threads/848773/Implement-dynamic-Password-Policy-from-database-using-RegularExpression-Validator-in-ASPNet/http://www.aspforums.net/Threads/848773/Implement-dynamic-Password-Policy-from-database-using-RegularExpression-Validator-in-ASPNet/Mon, 02 Jun 2014 04:12:42 GMTHow to set Maximum Character Length of Multiline Textbox using RegularExpression in ASP.Net<p>How to set MaxLength of multiline textbox using RegularExpression</p>http://www.aspforums.net/Threads/863759/How-to-set-Maximum-Character-Length-of-Multiline-Textbox-using-RegularExpression-in-ASPNet/http://www.aspforums.net/Threads/863759/How-to-set-Maximum-Character-Length-of-Multiline-Textbox-using-RegularExpression-in-ASPNet/Wed, 03 Jul 2013 04:29:02 GMT