Error to match with my REGEX

May i have some help to get those string with Regex .. Here is my source code ..

help me !!!

String t="01-21 10:56:41.161 D/RILJ    ( 2785): [rild] [2058]< VOICE_REGISTRATION_STATE {1, 271c, 0000058d, 16, null, null, null, null, null, null, null, null, null, null, null}";
String Exp= "(VOICE_REGISTRATION_STATE) .(\\d+), (\\w+), (\\w+), (\\d+),";
Pattern p = Pattern.compile("\\b"+Exp+"\\b", Pattern.CASE_INSENSITIVE);

Matcher m = p.matcher(t);

// indicate all matches on the line

    if (m.find()) {

  Toast.makeText(getBaseContext(),"band="+m.group(2),Toast.LENGTH_SHORT).show();
  Toast.makeText(getBaseContext(),"Lac="+m.group(3),Toast.LENGTH_SHORT).show();
  Toast.makeText(getBaseContext(),"CID="+m.group(4),Toast.LENGTH_SHORT).show();
  Toast.makeText(getBaseContext(),"Tech="+m.group(5),Toast.LENGTH_SHORT).show();
    }

Answers


The problem is only with the word boundary you added at the last. Just remove it. Because there isn't a word boundary exists between a comma (which exists next to the number 16) and a space. \b matches between a word character and a non-word character.

Pattern p = Pattern.compile("\\b" + Exp, Pattern.CASE_INSENSITIVE);

Just play with adding a word boundary at the last in here.


Need Your Help

View Cell error in Xamarin.Forms Windows Phone

listview xamarin windows-phone xamarin.forms

My app have two list view which loads from an url. First is the main category and the second is sub-category. While clicking on the first item in main category list it will populate the sub categor...

how to write global services in angular js

javascript angularjs html5 google-api

I am writing the application for i-banking , how to use angular JS , as we have an idea about banking , left side main link under every main link 3 to 4 sub links will be there .

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.