Regex in preconditions

I saw this in the release notes: New expression/query language used in search filters and preset preconditions.

Don’t suppose it’s in the docs yet? And will there be any support for regex in preconditions? That would have been great!

No regex support but you can use LIKE and NOT LIKE operators (work similar to SQL). It’s actually relatively easy to implement regex support but then preconditions won’t always be valid queries (e.g. won’t be able to click the precondition to go to the search page). I know MongoDB supports regular expressions but I plan to support other database engines in the next release and regex isn’t commonly supported in database engines.

mysql/mariadb supports regex like (https://www.geeksforgeeks.org/mysql-regular-expressions-regexp/)

Postgres does as well… https://dba.stackexchange.com/questions/10694/pattern-matching-with-like-similar-to-or-regular-expressions-in-postgresql

Interesting! I had no idea. I guess let’s see if there are going to be cases where LIKE is not sufficient.

1 Like

We have a use case now that would benefit from this. We’d like to filter on either product class or model where both start with Nokia (these are various Nokia Beacons) but the rest differs.

you should try with the precondition:

InternetGatewayDevice.DeviceInfo.ProductClass LIKE ‘Nokia%’ OR InternetGatewayDevice.DeviceInfo.ModelName LIKE ‘Nokia%’

I’ll try that!

Thanks! :slight_smile: