Hi,
I have a js code for validating a textbox. But the problem is that, the same regex is not working in code behind. See the code:-
<script type="text/javascript">
$(document).ready(function () {
$('#ctl00_topNavigation_txtSearch').keyup(function () {
var $th = $(this);
$th.val($th.val().replace(/[^.%a-zA-Z0-9 ]/g,
function (str) {
alert('Special characters not allowed except %');
return '';
}));
});
});
</script>
I am using like this, but it is not working
System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex("/[^.%a-zA-Z0-9 ]/g");
I want this /[^.%a-zA-Z0-9 ]/g, same regex to be used in Code-behind. Please help.
Go to the complete details ...