regex (Google Sheets)正则表达式提取字符串中最后一个出现的数字(后面可能有更多字符)[重复]

dpiehjr4  于 2023-05-01  发布在  Go
关注(0)|答案(1)|浏览(95)

此问题已在此处有答案

Regular expression to match last number in a string(4个答案)
4天前关闭。
请注意,我试图在Google Sheets中做到这一点,它显然使用了RE2。
我试图从标题中提取鞋码,标题中有其他数字,如型号等。Regexextract匹配的大小。大小通常在字符串的末尾,但有时在它后面有其他字符,或者可以用括号括起来。
样本数据:

Nike - GS AIR MAX '95 [905348-028] Anthracite/Amarillo/Black/Wolf Grey 6.5
Nike - AIR MAX 95 ERDL Party [AR4473-001] Black/Multi Color 11.5
Nike Womens Air Max Torch 4 Running Shoe (8, White/Black-Volt-Laser Crimson)
NIKE Men's Air Max 2017, Bright Crimson/Black, 8 M US
Nike Mens Air Max 97 Qs Running Shoes (11)
Nike Men's Air Max 270 React Running Shoes (Black/Oil Grey/Grey Black, 12)
Nike Men's Air Max 200 Running Sneakers (12, Habanero Red/Oil Grey)
Nike Air Max Camden Men's Slide Sandal (Black/White/Black, Numeric_12)

预期输出:

6.5
11.5
8
8
11
12
12
12

我所尝试的:

REGEXEXTRACT(A1, ".*(\d\d\.?\d.*)")
REGEXEXTRACTA1, "\(?\d\d?\.?\d?\)?\z")

请帮帮我

v64noz0r

v64noz0r1#

这里有一个方法:

=map(A:A,lambda(Σ,if(Σ="",,lookup(9^9,split(regexreplace(Σ,"[^\d.]","🐠"),"🐠")))))

相关问题