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

Customize the Sharepoint add list column page

sharepoint list

I have defined a custom Sharepoint list for special attributes related to a software application inventory and installed it as a feature. I also want to group these attributes in categories. How co...

Slow UITableView scrolling

iphone ios4 uitableview scroll

Edit----- i done the same code on english record scrolling speed remain fast as usual and its working fine, but when i am fetching Arabic data scrolling is slow again. is this a problem with arabic

Read only the specific tag from RSS Feed

java android wordpress xml-parsing rss-reader

I'm trying to learn how to make RSS Reader for my android app by following this tutorial.

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.