Sql regexp\u substr字符串中的数字比率

Sql regexp\u substr字符串中的数字比率,sql,regex,amazon-redshift,regexp-replace,Sql,Regex,Amazon Redshift,Regexp Replace,如何利用redshift中的regexp\u substr函数从字符串中提取数字比率?示例: Product name 1:4 subtype name 10:5 product name [5:1] product name product name [1:15] 希望只捕获文本的1:4部分 谢谢您可以像这样使用regexp\u substr: 这将提取模式的第一个匹配项(如果至少有一个数字,后跟分号,然后至少有一个数字)。请使您的示例数据代表它在数据库中的实际外观。单线性样本数据没有帮助

如何利用redshift中的regexp\u substr函数从字符串中提取数字比率?示例:

Product name 1:4 subtype name
10:5 product name
[5:1] product name
product name [1:15]
希望只捕获文本的1:4部分

谢谢

您可以像这样使用regexp\u substr:


这将提取模式的第一个匹配项(如果至少有一个数字,后跟分号,然后至少有一个数字)。

请使您的示例数据代表它在数据库中的实际外观。单线性样本数据没有帮助
regexp_substr(mycol, '[0-9]+:[0-9]+')