-1

What does it mean "[^a-zA-Z]+" ?

I am a beginner in JAVA and not getting what does it mean .

Rajkamal
  • 7
  • 3
  • Hello. Have a look at regular expressions. For example: http://www.vogella.com/tutorials/JavaRegularExpressions/article.html (found on google searching for "java regular expression") – dvaergiller Jul 30 '18 at 14:17
  • The [docs](https://docs.oracle.com/javase/10/docs/api/java/lang/String.html#split(java.lang.String)) clearly state that the `split` method accepts a regular expression, with a link to tell you the syntax. There is tons of online material if you still don't understand from googling "regular expressions java". – bcsb1001 Jul 30 '18 at 14:18
  • and here the official documentation [Pattern](https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html) - despite the other sources probably being better to start with - and be aware that split returns the parts that did not match the regular expression – user85421 Jul 30 '18 at 14:19

3 Answers3

2

It means split the string on sequences of one or more consecutive non-letters. Study https://en.wikipedia.org/wiki/Regular_expression

Eg. if s="abc, zzz!,ccc=ddd0eee" then words = {"abc", "zzz", "ccc", "ddd", "eee"}

memo
  • 1,739
  • 7
  • 18
0

It's called RegEx , or Regular Expression , which defines a search pattern into a String.

You can find a good tutorial with examples here

Leviand
  • 2,567
  • 3
  • 24
  • 35
0

It's regular expression. This one mean "match all strings that contain a non-letter". Also you can learn regex https://www.marksanborn.net/howto/learning-regular-expressions-for-beginners-the-basics/