[android-developers] Re: Regular Expression Help

2009-01-14 Thread Josh Dobbs
Thanks! that works perfectly. On Wed, Jan 14, 2009 at 7:27 AM, Al wrote: > > Both A T and Faber's solutions should work fine if you add the check > for uppercase letters also: > >String foo = "aAsdjshdIUjkshf"; >System.out.println(foo.matches("[a-zA-Z]+") ? "Yay"

[android-developers] Re: Regular Expression Help

2009-01-14 Thread Al
Both A T and Faber's solutions should work fine if you add the check for uppercase letters also: String foo = "aAsdjshdIUjkshf"; System.out.println(foo.matches("[a-zA-Z]+") ? "Yay" : "Nay" ); Prints 'yay'. String foo = "aAsdjs1234hdIUjkshf";

[android-developers] Re: Regular Expression Help

2009-01-14 Thread A T
Can you give us a sample input and output that is failing? I'd like to see the exact regex and test string(s) you are using. On Wed, Jan 14, 2009 at 10:20 AM, Josh Dobbs wrote: > That doesnt work either. what i want to do is check the entire length of > the string to ensure that only a-z are i

[android-developers] Re: Regular Expression Help

2009-01-14 Thread Josh Dobbs
That doesnt work either. what i want to do is check the entire length of the string to ensure that only a-z are in the string and that there are no special characters. On Wed, Jan 14, 2009 at 7:15 AM, Faber Fedor wrote: > > > On Wed, Jan 14, 2009 at 10:00 AM, Dan Dumont wrote: > >> It is check

[android-developers] Re: Regular Expression Help

2009-01-14 Thread Faber Fedor
On Wed, Jan 14, 2009 at 10:00 AM, Dan Dumont wrote: > It is checking the entire length of the string... your pattern is not > doing what you want. > > I suggest you read up on regular expressions. Your regexp says: > Match 1 character a-z, followed by any character zero or more times. No it

[android-developers] Re: Regular Expression Help

2009-01-14 Thread Josh Dobbs
Thanks for the suggestion but it's still not working. There's got to be a way to do this without looping through a charachter at a time. On Wed, Jan 14, 2009 at 7:03 AM, Dan Dumont wrote: > Sorry, that's "Match 1 character *NOT *a-z, followed by any character zero > or more times." > > try "^[^

[android-developers] Re: Regular Expression Help

2009-01-14 Thread Dan Dumont
Sorry, that's "Match 1 character *NOT *a-z, followed by any character zero or more times." try "^[^a-z]+$" On Wed, Jan 14, 2009 at 10:00 AM, Dan Dumont wrote: > It is checking the entire length of the string... your pattern is not > doing what you want. > > I suggest you read up on regular e

[android-developers] Re: Regular Expression Help

2009-01-14 Thread Dan Dumont
It is checking the entire length of the string... your pattern is not doing what you want. I suggest you read up on regular expressions. Your regexp says: Match 1 character a-z, followed by any character zero or more times. On Wed, Jan 14, 2009 at 2:28 AM, Josh wrote: > > i have the follo

[android-developers] Re: Regular Expression Help

2009-01-14 Thread A T
The Java matcher tries to match the entire string, unlike other regex engines. Try this: if (!Pattern.matches("[a-z]+", DrawingName.getText().toString())) { //do nothing for now DrawingName.setText("WRONG"); } Notice the "!" before the expression. On Wed, Jan 14, 2009 at 2:28 AM, Josh