【发布时间】:2018-07-18 04:57:59
【问题描述】:
我想在 Hive 中使用 regexp_extract 提取 URL 中 '/bla-bla-bla/' 和 'a12345' 之间的单词 "this-is-the-word"。
输入:www.website.com/bla-bla-bla/this-is-the-word.a12345.anotherword.blabla
期望的输出:这就是单词
我在下面尝试过,但都没有奏效。什么 RegEx 将从这个输入中实现我想要的输出?
regexp_extract(URL,'^.*[/]bla[-]bla[-]bla[/]([a-z]+)\\.(a([0-9]+))*$',1)
regexp_extract(URL,'^.*[/]bla-bla-bla[/]([a-z]*)[.]a([0-9]+)*$',1)
【问题讨论】: