Search code examples
androidregexlogcatandroid-logcat

Android Logcat regex with app tag and custom TAG


I'm searching for a regex that I could se in Android Studio custom filter on logcat window. The window look like this : filter window

here is a log sample that I need to filter :

08-06 15:46:13.883  27841-12352/tv.me.sdkapptest D/me#BADTAG﹕ process
08-06 15:46:13.883  27841-12352/tv.me.sdkapptest D/me#BADTAG﹕ processUri
08-06 15:46:13.884  27841-12352/tv.me.sdkapptest D/me#BADTAG﹕ About to create doc from InputStream
08-06 15:46:13.886  27841-12352/tv.me.sdkapptest D/me#BADTAG﹕ Doc successfully created.
08-06 15:46:13.887  27841-12352/tv.me.sdkapptest D/me#BADTAG﹕ About to merge doc into main doc.
08-06 15:46:13.887  27841-12352/tv.me.sdkapptest D/me#XmlTools﹕ xmlDocumentToString
08-06 15:46:13.895  27841-12352/tv.me.sdkapptest D/me#BADTAG﹕ Merge successful.
08-06 15:46:13.895  27841-12352/tv.me.sdkapptest D/me#BADTAG﹕ Doc is a wrapper.
08-06 15:46:13.905  27841-12352/tv.me.sdkapptest D/me#BADTAG﹕ processUri
08-06 15:46:13.905  27841-12352/not.to.me D/me#BADTAG﹕ begin
08-06 15:46:13.905  27841-12352/tv.me.sdkapptest D/me#MainActivity : so

I want to keep line with tv.me.sdkapptest that not contain me#BADTAG or me#XmlTools

As a result, only the last line should match. I'm already using this : ^((?!(#BADTAG)|(#XmlTools)).)+$ but is does not remove not.to.me lines.


Solution

  • Actually the regex I posted in the question is the one. The things is that I was misreading the filter pannel which have the log tag, log message and package name. In my case, the package name is tv.me.app and the regex should remove on me#BADTAG or me#XmlTools in the tag log.

    Here is the correct filter configuration enter image description here