darrachequesne / spring-data-jpa-datatables

Spring Data JPA extension to work with the great jQuery plugin DataTables (https://datatables.net/)
Apache License 2.0
440 stars 174 forks source link

Is it possible to do a regular expression search using ~ in PostgreSQL? #148

Closed fooo19 closed 1 year ago

fooo19 commented 1 year ago

I would like to achieve regular expression searches by using PostgreSQL. In PostgreSQL, I can search with the following query.

SELECT * FROM table WHERE id ~ '.*';

I have looked into the possibility of achieving this with reference to ticket #31, but '~' is an operator, so criteriaBuilder.function() cannot be used. https://github.com/darrachequesne/spring-data-jpa-datatables/issues/31

Is there any way to make this happen?

darrachequesne commented 1 year ago

Hi! I guess you already know it, but Postgresql 15 now has a regexp_like() method.

Reference: https://www.postgresql.org/docs/15/functions-matching.html

For previous versions, I'm not sure whether it's possible.

darrachequesne commented 1 year ago

Closed due to inactivity, please reopen if needed.