.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to check for space in a password regex having multiple condition

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :.NET Framework
I have a requirment where in the password field should accept all keys except space, it should have atleast one number , length should be 6 to 50
I tried following but did not work
1) Regex = @"^.*(?=.{6,50})(?=.*\d)(?=.*[a-zA-Z]).*$"

2) ^(?=[^\s])(?=[^\s]{6,50})(?=[^\s]*\d)(?=[^\s]*[a-zA-Z]).*$

Following are my test input text ( test case no 2 is having space at end)

ShouldNOT 654321-4
Should NOT654321-5
S houldNOT654321-6
ShouldNOT65432 1-7
S houldNOT 654321-9

Please help.

Thanks in Advance.
Rajendra Dewani

Regards Rajendra Dewani

View Complete Post

More Related Resource Links

how to multiple condition in if statement in asp.net C#



i am using if condition to find out a time

if(time=="08 AM)


response.write"shift A";


but problem is how can i put multiple condition in if like

if(time=="06 AM" and "08 AM" and "07 AM")

Is there something else I need to 'check' to approve multiple documents


I can't seem to approve multiple documents even when following the proper procedure.

I'm using MOSS, with an internet/Publishing site.  I go to site actions >> manage Content, check the checkboxes next to the items I need approved/checked in (they all have the same 'status' like draft, or pending), I click either approve or check in/publish depending on what I'm trying to do, and the only item that gets approved is the last item I checked. 

There is a workflow attached that when I click approve, I'm brought to the approval workflow page to add approvers and such, but it only lists one item for approval.

Anyone have any idea why that is, or has anyone experienced this before? 

Please heeeeeeeeeeeelp.

Sharepoint: In Calculated Column, Code with multiple "IF" condition does not work.

Implemantation:  Calculate expected resolve date exclude "Saturday" and "Sunday"  based on Priority and Severity.Columns are:1. Priority:2. Severity:3. Raised on: Date record createdCode: Below is the code which contains multiple "If" conditions. For quick undersatnding, i separated major If condition. Below code does not work and sharepoint gives me Sytax error message. =IF(OR(Priority="Critical",Severity="Critical"),IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+3,[Raised on]+1),     IF(OR(Priority="HIGH",Severity="HIGH"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+4, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+4,[Raised on]+2)) ,   IF(OR(Priority="MEDIUM",Severity="MEDIUM"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+3),"dddd")="Saturday",[Raised on]+5,[Raised on]+3)) ) ,   IF(OR(Priority="LOW",Severity="LOW"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+6, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+6, IF(TEXT

Receive/Delete Multiple FTP Files based on condition using SCRIPT(VB) TASK

I am trying to receive and delete multiple FTP files from a remote FTP server using Script task Below is the code   Dim FTPConnMgr As ConnectionManager FTPConnMgr = Dts.Connections("FTP Connection Manager") Dim FTPClientConn As FtpClientConnection = New FtpClientConnection(FTPConnMgr.AcquireConnection(Nothing)) Dim FileTimeStampNew As String = "20100913021807" Dim remoteFileNames(0) As String remoteFileNames(0) = Dts.Variables("FtpRemoteDirectory").Value & "*" & FileTimeStampNew & ".*" 'Below hardcoded FileName works good. But the problem is there are lots of file in the FTP folder that I dont want to receive 'remoteFileNames(0) = Dts.Variables("FtpRemoteDirectory").Value & "Company_alpha_Full_20100913021807.xml" Dim localPath As String = Dts.Variables("FtpLocalDirectory").Value FTPClientConn.Connect() FTPClientConn.ReceiveFiles(remoteFileNames, localPath, False, False) FTPClientConn.Close() Dts.TaskResult = ScriptResults.Success End Sub End Class If i specifically mention the RemotefileNames this works fine but, when I say *.* it executes succefully but doesn't receives the file. Please advice how to receive multiple file based on a variable BR, AWM

Multiple Selection Check box 2010

I am using a multiple selection checkbox that gets it's contents from a list that I have manually entered in the properties of the box. I have promoted the field add it appears in the library as a column. However, when I select a box (one or multiple for that matter) it does not appear in the field. I had added the field to the view to see the entry and it is blank.

RegEx for strong password

Hi I need  RegEx expression for the following: Passwords must be at least eight characters including at least one number and one special character (punctuation, symbol or upper/lower case character).  Note: The  RegEx will be used in .NET   Thanks much!

how check username and password store in database

hi i have login page. how check username and password store in database . plz reply with code.i did it by form authentication b ut it not work.

Replace space from string - REGEX.



I have some problem with RegEx.

I have text:

"something here [tagQuote=Name of Author]bla bla bla[/tagQuote] something here"

And now I want to replace all the whitespace character in quote attribute with "%#%#%#%".

So I want to have: [tagQuote=Name%#%#%#%of%#%#%#%Author]bla bla bla[/tagQuote]

So remove all of the whitespaces between "[tagQuote=" and "]...[/tagQuote]"

Regex: password must contain one number, one letter, and 0 or more special chars


I'm trying to validate a password, and I'm almost there, but need some help finishing it off. Here's what I need:

1) 6-10 characters

2) At least one alpha AND one number

3) The following special chars are allowed (0 or more): !@#$%

Here's what I have:


Passwords that should work: test1ng, abc123, abc1234567, 123abc, abc!123, !@#$%1abcd, !@#$%a9

Passwords that shouldn't work: a, 1, a1, 1$, %, abc!@#, 012345, a1234+, abcde, test*ng, abcde!, !@#$%!, a1234567890, testit!0987, 1abcdefghij

It works on all my test cases, except it allows "a1234567890", "testit!0987", and "1abcdefghij", none of which should be allowed, since they contain more than 10 chars. What am I missing?

Regex question with multiple replaces


I've never been good with Regex, but I'm sure this can be done. I'm basically trying to regex to avoid using two Replace methods on a string. For example, how would I replace a and b in a string with a space using regex in C#? Or how would I convert this line?

myString.Replace("a", " ").Replace("b", " "); 

reading Multiple queries in If condition


I have search input on my web page txtSearch.text(Column name is JobNO ,this column present in all the 3 tables), when i submit a value click on search button it has to read 3 tables.is it appropriate writing 3 queries in if condition..something like follows but not sure of it

if  txtSearch.text<>"" then
Query=select * from ship
elseif txtSearch.text<>"" then
Query=select * from openorder
Query=select * from schedule
end if

when i give above input it should read 3 tables and write the value on grid view,i am held up here and thankful to you can any one provide the possible solution

How to check (login Credentials) user name and password to access sharepoint server 2007 programmati

my issue is...

while user entered his/her Username:xyz
i need to check programmatically either username & password exists ot not in sharepoint server 2007 from windows form application.

and i know how to check username,but i don't know how to check password.

you can check username in below ways..

 SPSite SharepointSiteObj = new SPSite(SiteUrl);
 SPWeb SharepointWebObj = SharepointSiteObj.OpenWeb("/");

 SPUserToken token=SharepointWebObj.AllUsers[userName]

from this i can get user name..




Regex with exceptions to check incorrect punctuation


Hi to all,

I'm faced with the following problem:

I need to check a punctuation rule in a large amount of text. For this purpose, I want to find all occurances of a word which is NOT preceded by a comma.

The grammatical rule states that the words XYZ, UVW, QRS  must be preceded by a comma, exluding the cases when they are preceded by the words ABC, DEF, GHI, in which cases the comma is not necessary.

1. Lorem ipsum nam ne xyz fuisset efficiantur voluptatibus, albucius molestie neglegentur cu quo. - must be matched because xyz is NOT preceded by a comma
2. Lorem ipsum nam ne, xyz fuisset efficiantur voluptatibus, albucius molestie neglegentur cu quo. - must NOT be matched because xyz is preceded by a comma
3. Lorem ipsum nam ne abc xyz fuisset efficiantur voluptatibus, albucius molestie neglegentur cu quo. - must NOT be matched because xyz is preceded by abc and the comma is omitted correctly
4. Lorem ipsum nam ne, abc xyz fuisset efficiantur voluptatibus, albucius molestie neglegentur cu quo. - must be matched because xyz is preceded by abc but the comma is NOT omitted

Can anyone help me to construct a regex that satisfies the above conditions - with and without lookarounds, if it's possible?

Thank you very much in advance!

Check password before execute WCF service


Hi all.

I wrote a WCF service that can backup from DB. I just want that this service check a password then execute.  Where should I write a password and pass it to the service?

Please give me a code for both client and service side. Please help just on this scenario.

Each problem has a solution.

Error in check user name/password in basicHttpBinding WCF


Hi all.

I wrote a service that use a basicHttpBinding. It had worked correctly.

I want to check a simple u/p before execute.

But I get this error:

HTTP request streaming cannot be used in conjunction with HTTP authentication.  Either disable request streaming or specify anonymous HTTP authentication.
Parameter name: bindingElement

Service config:


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

Problem With space When updating password of active directory users from asp.net


Hello Friend's

From long time i am facing problem with Reseting password of users of active directory from asp.net.

The coding is work fine when there are no space in username but it's cause a problem when there are space in username.


usernametochange = "Ketan Patel";
                       ds.Filter = "(&(objectClass=user)(sAMAccountName=(" + usernametochange + ")))";
                       ds.PageSize = 100;

                       SearchResult account = ds.FindOne();
                       DirectoryEntry user = account.GetDirectoryEntry();
                       object[] oPassword = new object[] { "krtya#123" };

                           object ret = user.Invoke("SetPassword", oPassword);

if you have any idea about it please help me.

Thank you.....

How do I handle IsSelected Condition in multiple DataTriggers case ?


Hi all,

I have a customize listBox in which I am defining a DatatTemplete for that ListBox, the code is something like:



<ListBox Name="lstOfImages" 
     Background="Red" >          



            <Grid x:Name="mainGrid">

                 <ColumnDefinition Width="38"/>
                 <ColumnDefinition Width="*"/>

               <Image x:Name="FirstCulomnPanel"

               <Border x:Name="SecondCulomnPanel"
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend