Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用以下函数来查找整数:where NZ_SQLEXTN..REGEXP_LIKE(d.ID, '[0-9]')
where NZ_SQLEXTN..REGEXP_LIKE(d.ID, '[0-9]')
我只是注意到它没有拾取负数。当我这样做where NZ_SQLEXTN..REGEXP_LIKE(d.ID, '[^0-9]')时,结果集都是负数。
where NZ_SQLEXTN..REGEXP_LIKE(d.ID, '[^0-9]')
如何在正则表达式中包含负数?
您的正则表达式实际上只匹配 0-9 的数字,它不会匹配负数或浮点数。
如果你想支持更多的负面,你可以使用:
-?[0-9]+
如果你想支持负数和浮点数,那么你可以使用:
-?[0-9]+[.]?[0-9]* or -?\d+\.?\d*