Regular expressions _ # at the end of a line

I am using the REGEXP_LIKE function in Oracle 10g to find values ​​in a column with the suffix _ # (e.g. _1, _2, etc.). I can find _ # in any part of the value using the query below, but can I only return values ​​with _ # at the end?

SELECT * FROM Table WHERE REGEXP_LIKE (COLUMN,'_[[:digit:]]') 
0
oracle plsql regex
source share
2 answers

Of course. Use ...

 SELECT * FROM Table WHERE REGEXP_LIKE (COLUMN,'_[[:digit:]]$') 

The $ character matches the end of line.

+11
source share

No need to use reg exp.

 select * from table where substr(column,-2) between '_0' and '_9'; 
+2
source share

All Articles