相扑逻辑 : Count every matching string within a field

标签 sumo sumologic

我有一个已解析的字段,我需要计算给定字符串在其中出现的次数。这看起来相对简单,但我一直在搜索相扑文档,现在我不确定这是否可能。请帮忙!

最佳答案

我有一个使用 replace() 的 hacky 解决方案的想法正则表达式变体。
inputField是您的输入字段,您想计算次数 is发生在 inputField , 然后

| "This is a very hacky solution which might get you in trouble" as inputField
| replace(inputField, /is/, "@") as matched
| replace(matched, /[^@]/, "") as skipTheRest
| length(skipTheRest) as finalCount
解决方案假设 @不存在于输入字段中。
免责声明:我目前受雇于 Sumo Logic。

关于相扑逻辑 : Count every matching string within a field,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62782151/

相关文章:

sumologic - 在 Sumo Logic 中,如何搜索匹配正则表达式的日志?

arrays - Sumologic - 将 JSON 数组拆分为多个记录

jquery - JavaScript 应用程序的 Sumologic

python - 如何运行 traci.start 进行相扑模拟

kubernetes - Sumo Logic kubernetes 集成要求不存在 Prometheus

android - 如何提供SUMO遥测数据?

simulation - SUMO模拟中如何在整个模拟过程中保持恒定的车辆数量?

compiler-errors - 我应该如何调试此FileNotFoundError?

c++ - libswscale/swscale.h : No such file or directory