I’m using asp.net 1.1 with Visual Studio 2003 (vb.net). I have a program that checks a url to make sure it’s valid and that it is a pdf file. What I want to do is make it so the check is case-insensitive. Below you can see how I used “[pP][dD][fF]” to make the search for “pdf” case-insensitive, but I don’t want to do it that way (I may want to later make other parts case-insensitive).
I see in the Help that there is an “IgnoreCase” option, but I don’t know how to utilize it.
The first line below makes the url criteria, then the conditional statement checks to see if the url is how I require it to be. But I don’t see how to make it case-insensitive. I don’t see how I would use “urlRegEx.Options.IgnoreCase”. Can you help? Thank you!
(pdfFileUrl is the url itself)
urlRegEx = New Regex("^(http[s]?://).+[pP][dD][fF]$")
If urlRegEx.IsMatch(pdfFileUrl) Then
Trace.Warn("urlRegEx", "Url should be okay.")
Trace.Warn("urlRegEx", "Url failed!")