^[0-9]*$ -I used this is for accept digits and
^[A-Za-z]*$ this is for alphabets
^[A-Za-z0-9]*$ I used this expression for accept digits and alphabets and
these are work correctly
and
If I entered special characters(!@$@#%$^&%&) I am getting an error message
but I can enter these characters
But my requirement is I dont want to accept special characters from my keyboard to my textbox
EX:numeric textbox can accept only digits other characters can not be accept
Thanks
Loading
VulpesPosted Sep 23, 2011, 11:08 AM
For example, if we take this:
string regExp = @"^\d+$";
then it will match a string which contains any number of consecutive digits, as long as there's at least one and no other character appears.
To match a minimum of 3 and a maximum of 12 digits, you'd need to change it to:
string regExp = @"^\d{3,12}$";
jayaramPosted Sep 23, 2011, 10:25 AM
In my regeex expression I set maxlength(ex:\d{4}) but
maxlength is not working based on expression.
In this case maskedEditbox control length is taken by Maxlength property of RadmaskedEditbox.
how can i set maxlength for maskedEditbox by using regex expression
VulpesPosted Sep 21, 2011, 10:53 AM
jayaramPosted Sep 11, 2011, 4:24 AM
Once you sent code for handle unwanted data to paste in textbox this validate after leave from textbox but I want to ignore data from my textbox , I modify for this requirement e.SuppressKeyPress = !(regex.IsMatch(Clipboard.GetText()));
private void RadMaskedEditBox_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Insert && e.Modifiers == Keys.Shift)
|| (e.KeyCode == Keys.V && e.Modifiers == Keys.Control))
{
Regex regex = new Regex((sender as RadMaskedEditBoxElement).Mask);
//e.Handled = !(regex.IsMatch(Clipboard.GetText()));
e.SuppressKeyPress = !(regex.IsMatch(Clipboard.GetText()));
}
}
But it is fail for to paste data by using mouse, can you tel me answer for this,
Thanks for You
VulpesPosted Sep 9, 2011, 4:41 PM
jayaramPosted Sep 9, 2011, 9:20 AM
Your answer working for only after entering the data in my textbox but its not working for while I entering the data in my textbox
VulpesPosted Sep 7, 2011, 10:54 AM
jayaramPosted Sep 7, 2011, 8:41 AM
Its not suitable for my requirement
EX: Valid data is : aa,bb,cc,abccd,ttamell,
I dont want to allow to my textboxes like following type data
Invalid data is: aaaaaa,bbbbb,dddd,jkljlkkkkkk....
I have written in the following way but its working only for when I entering last characters.
And its not working for entering data in middle or starting positions.
****I need to use regex expressions for this requirement*******
private void MaskedEditBox_KeyPress(object sender, KeyPressEventArgs e)
{
var previousCharacter =((RadMaskedEditBoxElement)sender).Text[(sender as RadMaskedEditBoxElement).Text.Length-2];
var nextPreviousCharacter = ((RadMaskedEditBoxElement)sender).Text[(sender as RadMaskedEditBoxElement).Text.Length-1];
if (e.KeyChar.ToString().ToLower() == previousCharacter.ToString().ToLower() && e.KeyChar.ToString().ToLower() == nextPreviousCharacter.ToString().ToLower())
{
}
}
VulpesPosted Sep 3, 2011, 3:53 PM
The output should be:
jayaramPosted Sep 3, 2011, 8:24 AM
Can you give me RegexExpression for if any three alphabets are the same(more than 3) it shouldn't be allowed.
E.g. ddd,asaaaaaaad,rammmmmm,ssssiva
VulpesPosted Sep 2, 2011, 11:26 AM
}
jayaramPosted Sep 2, 2011, 10:21 AM
Requirement 1:
I used Telerik Controls in My application,
RadMaskedEditBox.Mask="LLLLL" for letters
RadMaskedEditBox.Mask="####" for digits
RadMaskedEditBox.MaskType=Standered
In this situation I am getting underscores in my textbox depending on how many L's or #'s in Mask property, so Can you tel me how to remove those '_' OR
Give me another best way to do my requirement.
Requirement 2:
And I done another process for my requirement, I have written this code in KeyPress event, this is working for all my requirements but while I am using copy or cut then this is useless
radmaskededitbox_keypress(........)
{
Regex regex = new Regex((sender as RadMaskedEditBoxElement).Mask);
e.Handled = !(regex.IsMatch(e.KeyChar.ToString()));
}
so tel me the best way to do this ,
***Actually I need to do all this things by using Regex expressions***
VulpesPosted Aug 31, 2011, 5:31 AM
If it did and Regex were one of the options, then life would be a little easier :)
jayaramPosted Aug 31, 2011, 3:01 AM
ex:Masktexbox.Mask = "^[A-Za-z]"
Masktexbox.MaskType is Regex
VulpesPosted Aug 30, 2011, 10:12 AM