9
Answers

Regex Expressions

raja ramesh

raja ramesh

13y
1.9k
1
Hi,
        I am working on windows applications
I am using Regex Expressions, I can write regex expression for only digits but my requirement is first to letters are "CH" after my textbox has to accept only digits

Ex:    CH4324324
 CH11111 
        CH789798......

In this scenario I dont want to change value CH as prefix of that box

user has to change only after this prefix so any one can tel me regex expression.
problem 2:
I have written to handle unwanted data in keypress events like following way

Regex regex = new Regex((sender as RadMaskedEditBoxElement).Mask);
            if (!regex.IsMatch(e.KeyChar.ToString()))
                e.Handled = true;
            {
                return;
            }

But its working for only when I press key from keyboard but its not working for copy-paste and cut-paste and paste by using mouse but I want to handle unwanted data for paste 
How to do this ?


Any one can tel me reply for above two questions....


Answers (9)