0

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);

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by mihu
0

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 by ~s.o.s~: Don't use fake sigs; use the signature facility provided by the forum.

0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.