Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel file checking using RegularExpressionValidator

Posted on 2007-03-19
3
Medium Priority
?
476 Views
Last Modified: 2008-01-09
Hi

I am working on ASP.net2.0, C#

I have a regular expression which checks if file is xls or not

It works fine, if we sellect the file from local system or map drive

But it does not work if we take the file from map drive

like
\\barney\Testing\Excel Example_R1.xls

My RegularExpressionValidator is

<asp:RegularExpressionValidator id="RegExpFile" runat="server" ErrorMessage=" "
ControlToValidate="FileUpload1" ValidationExpression="^.+\.((xls)|(XLS)|(Xls))$"></asp:RegularExpressionValidator>


Please help

This is very urgent for me
0
Comment
Question by:dinesh_bali
3 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 18749605
It looks like the expression should work for
\\barney\Testing\Excel Example_R1.xls
Does it make any difference if you omit the "^.+"
0
 

Author Comment

by:dinesh_bali
ID: 18750278
Sorry, It was [a-zA-Z0_9].*\bxls\b

Is the ="^.+\.((xls)|(XLS)|(Xls))$

As I only want user should select only excel file, he should not able to select any other file

Thanks
0
 
LVL 16

Accepted Solution

by:
AlexNek earned 2000 total points
ID: 18753063
It is look OK, it can parse the lines. I test exresion. It is possible that you have an additional symbol in "wrong line" or missied new line symbol.
^ (anchor to start of string)
. (any character)
+ (one or more times)
.
Capture
  Capture
    xls
  End Capture
    or
  Capture
    XLS
  End Capture
    or
  Capture
    Xls
  End Capture
End Capture
$ (anchor to end of string)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question