Start New Discussion Reply to this Discussion Java Regular Expressions
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);
Related Article: wildcard pattern matching
is a Java discussion thread by anjoz that has 1 reply and was last updated 1 year ago.
mihu
Newbie Poster
3 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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>
Nisha105
Newbie Poster
1 post since Oct 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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 :)
mihu
Newbie Poster
3 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
© 2013 DaniWeb® LLC
Page rendered in 0.0561 seconds
using 2.65MB