Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter multiple words in Android Studio logcat

I want to see just a couple of words in logcat. In other words, just a given tags. I tried to enable Regex and type [Encoder|Decoder] as filter, but it doesn't work.

like image 727
Pitel Avatar asked Jan 13 '16 15:01

Pitel


People also ask

What is regex in Logcat?

regexp,AndroidStudio,logcat. Logcat provides several default filter options (Verbose, Info, Debug etc) and a simple pattern match filter, but the regex filter is the most powerful option for customizing logcat output.

How do I search in Logcat?

And other option is Right click on Logcat tab and then enable Floating mode. Then just resize the floating window so that the Logcat search can expand. Edit: You can also use CTRL+F to filter logcat. It will open new search bar and then you can try on that.


2 Answers

You should use a grouping construct:

(Encoder|Decoder)

Actually, you can just use

Encoder|Decoder

If you use [Encoder|Decoder], the character class is created that matches any single character E, n, c... |, D... or r.

See Character Classes or Character Sets:

With a "character class", also called "character set", you can tell the regex engine to match only one out of several characters. Simply place the characters you want to match between square brackets. If you want to match an a or an e, use [ae].

Another must-read is certainly Alternation with The Vertical Bar or Pipe Symbol:

If you want to search for the literal text cat or dog, separate both options with a vertical bar or pipe symbol: cat|dog. If you want more options, simply expand the list: cat|dog|mouse|fish.

When using (...) you tell the regex engine to group sequences of characters/subpatterns (with capturing ones, the submatches are stored in the memory buffer and you can access them via backreferences, and with non-capturing (?:...) you only group the subpatterns):

By placing part of a regular expression inside round brackets or parentheses, you can group that part of the regular expression together. This allows you to apply a quantifier to the entire group or to restrict alternation to part of the regex.

like image 122
Wiktor Stribiżew Avatar answered Sep 22 '22 00:09

Wiktor Stribiżew


you can just use Encoder|Decoder and must check Regex CheckBox too

like image 1
FatalMan Avatar answered Sep 25 '22 00:09

FatalMan