问题描述
我只想在logcat中看到几个字.换句话说,只是一个给定的标签.我试图启用 Regex 并键入 [Encoder | Decoder]
作为过滤器,但是它不起作用.
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.
推荐答案
您应使用分组构造:
(Encoder|Decoder)
实际上,您可以使用
Encoder|Decoder
如果使用 [Encoder | Decoder]
,则会创建与任何单个字符 E
, n
, c
... |
, D
...或 r
.
If you use [Encoder|Decoder]
, the character class is created that matches any single character E
, n
, c
... |
, D
... or r
.
请参见 字符类或字符集 :
另一个必读的内容肯定是 带有竖线或管道符号的替换 :
Another must-read is certainly Alternation with The Vertical Bar or Pipe Symbol:
使用 (...)
时,您告诉regex引擎进行分组字符/子模式的序列(对于捕获的字符/子模式,子匹配存储在内存缓冲区中,您可以通过反向引用和不捕获的(?:...)来访问它们code>您只能将子模式分组):
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):
这篇关于如何在Android Studio Logcat中过滤多个单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!