Print Page | Close Window

Need help with Regular Expression

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=15957
Printed Date: 29 March 2026 at 4:24am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Need help with Regular Expression
Posted By: vshriniwasan
Subject: Need help with Regular Expression
Date Posted: 23 July 2005 at 5:03pm
Guys,
 
I am tyring to use regular expression for validation of files...
 
Here is what regular expression MUST do...
 
All files must start with an alphanumeric character (0-9, a-z, A-Z)
All files must end with xls, doc, ppt.
 
Here is what I have I gotten so far...
 
^[0-9a-zA-Z]{1} > this will take care of the first caracter to be alphanumeric.
 
I am having problem with the extension of the file. I was thinking if I do [xls,doc,ppt]$ it will work... But it doesn't....
 
I want help creating one expression that will handle both in one notch... If needed I can do a second validation, but need the expression to validate the ending...
 
Please advise,
Shrini



Replies:
Posted By: vshriniwasan
Date Posted: 24 July 2005 at 12:38am
^[0-9a-zA-z]{1}.*(xls|doc|ppt)$ This takes care of it....
 
shrini



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net