English 中文(简体)
雪上加霜:对最后lash和 do之间的案文进行审核?
原标题:Snowflake: Regex for text between the last slash and dot?
  • 时间:2023-10-10 22:17:04
  •  标签:
  • regex

如果我有的话:

test_stage/parquet_location/9f7d37fd-7039-4454-94ef-2b0cd6c3206a_b1df97ad-54dc-4fc9-a099-1fb9cd6530be_custom_1696963985.parquet

我如何写上一条与以下案文相匹配的法规:_,该文本在最后的<代码>/和之间。 以上案文将与以下案文相匹配:

9f7d37fd-7039-4454-94ef-2b0cd6c3206a>

b1df97ad-54dc-4fc9-a099-1fb9cd6530be>/code>

www.un.org/Depts/DGACM/index_spanish.htm

I tried below expression but no luck: (?<=/)[^/_]+(_[^/_]+)*.parquet

为了澄清,我正在使用斯诺瓦克:

www.un.org/spanish/sc/presidency.asp regexp_substr_all(/abc_ds/ef/gh_xy_z.parquet , <regex_exp> ) AS配对器;

归还所有配对器

问题回答

我本人往往回避,但你的发言似乎非常简单,可以使用SPLIT。 你们是否想利用这样的东西?

with x as (
    select  test_stage/parquet_location/9f7d37fd-7039-4454-94ef-2b0cd6c3206a_b1df97ad-54dc-4fc9-a099-1fb9cd6530be_custom_1696963985.parquet  as str
    )

select split(split_part(split_part(str, / ,-1), .parquet ,1), _ ) as arr,
       array_contains( 9f7d37fd-7039-4454-94ef-2b0cd6c3206a ::variant,arr) as match
from x;

从内部抽取,首先发现最后的<代码>/之后的所有东西,然后从.parquet 中删除,其余插座则分为<>->>分离的阵列。 一旦有了这些阵列,你就可以在比较价值观方面做任何必要的工作。 在上述法典中,Im刚刚使用“array_contains,具体阐述,看在阵列中是否存在。 你们也可以平息阵列,不管什么基本需要。

我知道,这并没有明确地回答你关于reg的问题,因此,如果你不认为其有用的话,我就可以去掉答案,但这是斯诺瓦克的有效法典。





相关问题
Uncommon regular expressions [closed]

Recently I discovered two amazing regular expression features: ?: and ?!. I was curious of other neat regex features. So maybe you would like to share some tricky regular expressions.

regex to trap img tag, both versions

I need to remove image tags from text, so both versions of the tag: <img src="" ... ></img> <img src="" ... />

C++, Boost regex, replace value function of matched value?

Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match ...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...

Is it possible to negate a regular expression search?

I m building a lexical analysis engine in c#. For the most part it is done and works quite well. One of the features of my lexer is that it allows any user to input their own regular expressions. This ...

regex for four-digit numbers (or "default")

I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" ...

热门标签