I have a list of tweets about the mobile and a list of mobile phones name and now i have to make count for each of mobile phone names. I used array list to get the name of mobile phones as follows
brand_list.add("Samsung Galaxy S5");
brand_list.add("Nolia Lumia 525");
then I had a list of tweets about the phones like "RT @protectyrbubble: #PYBS5giveaway #WIN a Samsung Galaxy S5. Just follow @protectyrbubble and RT! Details & T&Cs http://t.co/u0NTM00rhA ht…"
then I used the following code to count for each of the phone as follows
for(int j=0;j<array_list.size();j++)
{
pattern = Pattern.compile(" ((.*)Samsung(.*)Galaxy(.*)S5(.*)",Pattern.CASE_INSENSITIVE) ;
matcher = pattern.matcher(array_list.get(j).toString());
while (matcher.find())
{
count++;
}
}
in the above ,array_list holds tweets about mobiles.Now if I use above regex it works fine for the above mentioned tweet but it doesnt work for string like
"Galaxy S5 Mini Sempat Nongol di Situs Samsung http://t.co/sinWiLpUNV"
so,I need a regex which also finds the above mentioned tweets.
Thanks in advance