>> Unfortunately, split() just asks for a delimeter character to "split" a
>> string into an Array of Strings.
[quoted text clipped - 7 lines]
>
> String[] noVowels = input.split("[AEIOUaeiou]+");
<psst>
I would have, ..if I understood regex's. ;-)
</psst>

Signature
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology
Thank you Thomas and Andrew. Much appreciated.
I probably should start a new thread for this one so everyone can see, but,
how does the regex of "[AEIOUaeiou]+" work. Why did Andrew's fail?
Regards,
Ben
> > Unfortunately, split() just asks for a delimeter character to "split" a
> > string into an Array of Strings.
[quoted text clipped - 7 lines]
>
> String[] noVowels = input.split("[AEIOUaeiou]+");
Andrew Thompson - 11 Mar 2004 23:03 GMT
> I probably should start a new thread for this one so everyone can see, but,
> how does the regex of "[AEIOUaeiou]+" work.
regex's present a quite powerful and subtle
way to search files, they have characters to
indicate things like 'any number of occurences of..',
'only if occurs after..' and such.
>..Why did Andrew's fail?
Because it was anything but subtle, and
..well, just plain *wrong* for what you wanted!
I hope someone can provide a good link to
a regex explanation. I will be checking it
out myself. :-)

Signature
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology
FISH - 12 Mar 2004 11:17 GMT
> Thank you Thomas and Andrew. Much appreciated.
>
[quoted text clipped - 3 lines]
> Regards,
> Ben
Regexp's are very powerful text matching patterns, and well worth
learning if you have the time. They are, however, quite involved
and not for the faint hearted. The example given above is a very
basic novice-level expression. They can get a lot more scarey! :-)
The split method accepts a re which it attempts to match in order
to divide up a String. In our example we wish to divide up on
vowels, case insensitive. The [ ... ] construct allows us to
specify a set (or 'class') of characters for the pattern. It will
act like a giant OR switch: A or E or I or O ..... Without the
[ ] the re will attempt to match the actual string "AEIOUaeiou".
The trailing + specifies that the previous construct (the class)
can appear one or more times - meaning that the re will gobble up
as many vowels as it can in a single match. This ensures that
sequences like ZZaaXX result in "ZZ" "XX" and not "ZZ" "" "XX".
However, the split() method discards empty strings anyway, so the
Javadocs say, so the trailing + is probably not needed (I think!)
but wise to include anyway just for readability sake.
-FISH- ><
Roedy Green - 17 Mar 2004 01:56 GMT
>Regexp's are very powerful text matching patterns, and well worth
>learning if you have the time. They are, however, quite involved
>and not for the faint hearted. The example given above is a very
>basic novice-level expression. They can get a lot more scarey! :-)
for some examples to get you going see
http://mindprod.com/jgloss/regex.html
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Andrew Thompson - 17 Mar 2004 06:56 GMT
> http://mindprod.com/jgloss/regex.html
Nice page Roedy. Bookmarked for reference.

Signature
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology