简体   繁体   English

SQL H2数据库从字符串中选择数字+字母数字字符

[英]SQL H2 Database select digit + alphanumeric char from string

I try to select just the numbers followed by a alphanumeric character我尝试只选择数字后跟字母数字字符

5h 1
5h 5 8h 8 12h 10
12h 10 48h 20
5h 1 8h 1 12h 1 24h 1 48h 1 72h 1
5h 1 8h 1 12h 1 24h 1 48h 1 72h 1

For example in the second line 5h 5 8h 8 12h 10 I need to remove numbers 5, 8, 10 ie which are not followed by a character.例如在第二行5h 5 8h 8 12h 10我需要删除数字5, 8, 10即后面没有字符。 Result should be 5h 8h 12h .结果应该是5h 8h 12h

I already removed specific chars with:我已经删除了特定字符:

REGEXP_REPLACE (resource, '[^\w\.@-]', ' ' )

Try this regex试试这个正则表达式

REGEXP_REPLACE (resource, '\\b[0-9]+\\b', ' ' )

Use \\\\b if \\b doesn't work.如果\\b不起作用,请使用\\\\b Am not sure if it will need double escape.我不确定它是否需要双重转义。

Regex101 Demo Regex101 演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM