Hallo everybody,

Can someone help me with some regexs for testing :
- in a textbox , i need to test only string carachters , not numbers,digits, spaces;
- in a textbox , i want to text only numbers, not strings, char..other.

Please..

Pattern patternForInfo = Pattern.compile("[a-zA-Z]", Pattern.CASE_INSENSITIVE);
Pattern patternForNumere = Pattern.compile("^[A-Z]{3,}", Pattern.CASE_INSENSITIVE);

instead of checking if it is a letter or a special character. you could check if it is a number between 0 to 9 so if all the characters are numbers you have number. it will be a lot easier for you.
even though you have a nice way to get the job done I suggest you use some of prewriten classes from. java api. for example. Character class has nice features that you can use. for example you can use isDigit() function to get if the character is a digit or not. anything you wanna do with a character you can do it with this class.

<snip>

Edited 6 Years Ago by ~s.o.s~: Don't use fake sigs; use the signature facility provided by the forum.

instead of checking if it is a letter or a special character. you could check if it is a number between 0 to 9 so if all the characters are numbers you have number. it will be a lot easier for you.
even though you have a nice way to get the job done I suggest you use some of prewriten classes from. java api. for example. Character class has nice features that you can use. for example you can use isDigit() function to get if the character is a digit or not. anything you wanna do with a character you can do it with this class.

rapidshare downloads

the first ideea is very good and useful for me,
thank you very much :)

This article has been dead for over six months. Start a new discussion instead.