RegEx 或 Pygrok 模式匹配
我有这样的文本
示例: “签证代码:ab c主号码:efg发现:ij k”
输出应如下所示: abc, efg, ijk
有没有办法,我可以使用 Grok 模式匹配或 Reg EX 来获取“:”后的 3 个字符(不考虑空格)?
I have text like this
Example:
"visa code: ab c master number: efg discover: i j k"
Output should be like this:
abc, efg, ijk
Is there a way, I can use Grok pattern match or Reg EX to get 3 characters after the ":" (not considering space) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

你可以从这个开始:
但是你还有更多的工作要做。例如,没有人能准确地猜出你所说的“字符”是什么意思。
除此之外,模式匹配系统匹配字符串,但不转换它们。您必须通过其他方式删除不需要的空格(这应该很容易)。
You can start with this:
But you have more work to do. For example, nobody can guess what you mean - exactly - by "characters".
Beyond that, pattern matching systems match strings, but do not convert them. You'll have to remove spaces you don't want via some other means (which should be easy).