Elastic search regex to get last 7 digits from right

我是研究僧i 提交于 2019-12-02 08:06:46

In ElasticSearch, the pattern is anchored by default. That means, you cannot rely on partial matches, you need to match the entire string and capture the last consecutive 7 digits.

Use

.*([0-9]{7})

where

  • .* - will match any 0+ chars other than newline (as many as possible) and then will backtrack to match...
  • ([0-9]{7}) - 7 digits placed into Capture group 1.

The Sense plug-in returns the captured value if a capturing group is defined in the regular expression pattern, so, no additional extraction work (or group accessing work) needs to be done.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!