Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm using the following function to find integers: where NZ_SQLEXTN..REGEXP_LIKE(d.ID, '[0-9]')

I just noticed that it's not picking up negative numbers. When I do where NZ_SQLEXTN..REGEXP_LIKE(d.ID, '[^0-9]'), the result set is all negative numbers.

How do I include negative numbers in the regex expression?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
292 views
Welcome To Ask or Share your Answers For Others

1 Answer

Your regex is actually matching only numbers from 0-9 it won't match negative nor floating points.

If you want to support more negative you can use:

-?[0-9]+

If you want to support negative and floating points, then you could use:

-?[0-9]+[.]?[0-9]*
or
-?d+.?d*

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...