String[] array=s.split("[!,?._'@s]+");
//new approach
s=s.trim();
if(s.length()==0)
{
System.out.println(0);
return;
}
String[] array=s.split("[^a-zA-Z]+");
System.out.println(array.length);
for(int i=0;i<array.length;i++)
String current_url = "https://{domain name}/{type of data}/4583236-{name-of-perpetrators}";
String[] urlParts = current_url.split("type of data}/");
String mySuburl = urlParts[1];
String[] suburl = mySuburl.split("-{name-of-perpetrators");
String mytext = suburl[0];
System.out.println(mytext);
Pattern p = Pattern.compile("(d+)|([a-zA-Z]+)");
Matcher m = p.matcher("810LN15");
List<String> tokens = new LinkedList<String>();
while(m.find())
{
String token = m.group( 1 ); //group 0 is always the entire match
tokens.add(token);
}
//now iterate through 'tokens' and check whether you have a number or text