c# - Problems with the following regular expression in RegularExpressionValidator control -
I have written the following regular expression that should only match the file name or folder name that does not end in .aspx. Validation Expiration = ". * * [^ (Aspx)] $"
But if this does not work, King of Regx land, please help I do Espacks, please. Extensions like ASPX etc. would also like to be invalid. (I have learned quickly how there is some difference between regular expressions of Nets and Jascript).
Can anyone help?
[^ abc]
means "a, b, or c" You do not want to have a negative character set, you should look negative:
validation expression = ". * * (? & Lt;! \ Aspx) $"
< Use P> RegexOptions.IgnoreCase
as an option in Regex.IsMatch
to make it case insensitive. In Javascript, where there is no negative eye, you can use a less efficient version with negative lookhead:
validation expression = "^ ( ?: (?! \ APX $).) * $ "
Comments
Post a Comment