Skip to content Skip to sidebar Skip to footer

Regexp To Match Logcat Brief Format With G_regex_match_simple

I'm trying to write a wireshark dissector for logcat logs in various text formats. To do it I need to detect which type of logcat I'm reading, and then get the respectable parts ex

Solution 1:

It works for me with two backslashes:

#include <glib.h>

int
main(int argc, char *argv[]) {
  gboolean res = g_regex_match_simple ("[IVDWE]/.*\\(\\s*[0-9]*\\):\\s.*",
                                       "I/bdAddrLoader(  184): option : f=/persist/bluetooth/.bdaddr",
                                       0, 0);
  g_message ("%s", res ? "true" : "false");

  return 0;
}

Post a Comment for "Regexp To Match Logcat Brief Format With G_regex_match_simple"