Hi Chris,
placing "(?i)" at the start of expression also doesnot work, it
gives me JavaScript Error "Syntax Error in regular expression".
i tried with both ways
ValidationExpression = "(?i)^.*?\.(txt|zip|doc|exe)$"
ValidationExpression =
"(?i)^(([a-zA-Z]
|(\\{2}\w+)\$?)(\\(\w[\w
]*))+(?i)\.(txt|TXT|doc|DOC)$".
I am using
- WinXP Professional
- VS.NET 2003
- Framework 1.1
- IE6 with SP1
Rajeev,
OK. I didn't know you were using JavaScript.
For client-side JavaScript in IE6, there are two different syntaxes
for regular expressions. They both work the same:
http://msdn.microsoft.com/library/en-
us/script56/html/js56jsobjregexpression.asp
Here's an example:
<HTML>
<HEAD>
<TITLE>Case-Insensitive JavaScript Regular Expression</TITLE>
</HEAD>
<BODY>
<SCRIPT language="JavaScript">
<!--
function IsFilenameValid_Version1(filename)
{
// Regex syntax using a RegExp object.
var re = new RegExp("^.*?\\.(txt|zip|doc|exe)$", "i");
return filename.match(re);
}
function IsFilenameValid_Version2(filename)
{
// Regex syntax using the native regex type.
var re = /^.*?\\.(txt|zip|doc|exe)$/i;
return filename.match(re);
}
var filename1 = "c:\\folder\\filename.TXT";
var filename2 = "c:\\folder\\filename.ppt";
if (IsFilenameValid_Version1(filename1))
document.write(filename1 + " is valid.<BR>");
else
document.write(filename1 + " is not valid.<BR>");
if (IsFilenameValid_Version2(filename2))
document.write(filename2 + " is valid.<BR>");
else
document.write(filename2 + " is not valid.<BR>");
//-->
</SCRIPT>
</BODY>
</HTML>
Hope this helps.
Chris.