簡體   English   中英

獲取 redshift 中 '/' 之后字符串的最后一次出現

[英]Get last occurrence for the string after '/' in redshift

我對正則表達式還很陌生,總是很難理解。 如果我能得到以下問題的答案,那將非常有幫助。

我在 redshift 表中有一列包含字符串,我想提取字符串的特定部分(最后一個“/”之后的字符串)。 例如,我的 redshift 表中有https://hello.com/my_first_website ,列名為customer_site ,我想從中提取my_first_website為 output。有人能告訴我一個可以幫助我提取它的正則表達式。

您可以使用regexp_substr function 如

SELECT regexp_substr('https://hello.com/my_first_website','[^/]*$')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM