String split, words including accented characters
java, regex
Solution
From http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
Categories that behave like the `java.lang.Character boolean ismethodname` methods (except for the deprecated ones) are available through the same `\p{prop}` syntax where the specified property has the name `javamethodname`.
Since `Character` class contains `isAlphabetic` method you can use
name.split("[^\\p{IsAlphabetic}0-9']+");
You can also use
name.split("(?U)[^\\p{Alpha}0-9']+");
but you will need to use `UNICODE_CHARACTER_CLASS` flag which can be used by adding `(?U)` in regex.
Problem
I'm using this regex: ``` x.split("[^a-zA-Z0-9']+"); ``` This returns an array of strings with letters and/or numbers. If I use this: ``` String name = "CEN01_Automated_TestCase.java"; String[] names = name.Split.split("[^a-zA-Z0-9']+"); ``` I got: ``` CEN01 Automated TestCase Java ``` But if I use this: ``` String name = "CEN01_Automação_Caso_Teste.java"; String[] names = name.Split.split("[^a-zA-Z0-9']+"); ``` I got: ``` CEN01 Automa o Caso Teste Java ``` How can I modify this regex to include accented characters? (á,ã,õ, etc...)