Grafana Regex符合名称
These are iPads and phones with their battery levels monitored in Grafana.
How can I filter it, so it will show me the iPads only (starting with device name "H.")
When I try regex like "/^H.$/" it doesn't work.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不是正则专家,但是
^h。$
从字面上看h。
。您也需要匹配任何可能的以下字符。您可以使用
\ w*
的数字,小写和大写字符来做到这一点。因此,就您而言,
^h。\ w*$
应该有效。编辑
仔细查看您的图片后,我意识到要过滤的名称是列的行
device_name
,而不是列名称本身。但是,使用的按名称过滤
过滤列名称,在您的情况下,在您的情况下device_name
和battery_level
。由于都不适合正则义务,因此返回“无数据”。要过滤列的结果,您必须使用
按值
过滤数据。您必须指定字段,即列device_name
,使用REGEX
作为gode> Match> Match
的类型,然后在value中输入REGEX
字段。如上所述,使用正则表达式。
Not a regex expert, but
^H.$
will only matchH.
literally.You need to match any amount and type of possible following characters as well; you can do that for numbers, lowercase, and uppercase characters with
\w*
.So in your case,
^H.\w*$
should work.EDIT
After having a closer look at your pictures, I realize that the names you want to filter for are rows of the column
device_name
, not the column names themselves. However, the usedFilter by name
filters the column names, in your casedevice_name
andbattery_level
. Since neither fit the regex, 'No data' is returned.To filter the results of a column you have to use
Filter data by values
. You have to specify the field, i.e. the columndevice_name
, useRegex
as type forMatch
and then enter the regex in theValue
field.Use the regex as explained above.