Regex based Keyword to list Uppercase letters


(Harinder Singh) #1

Matrix Version: 5.4.1.3

What is the best way to list the data contains uppercase letters only with an option for digits and non word characters?

I am trying to use the following keyword in the asset listing.

%ds__sn^contains:[\\^\[A-Z \s\d\W\]+$]:<li>{ds__sn}</li>: %

Result

  1. OP’T LAND
  2. KRANTZCKE
  3. ELLIS
  4. Egulian
  5. BUILD
  6. Clark

Regex filters are not working as expected. “Egulian” and “Clark” not suppose to appear in the listing. The regex filters are only working on lowercase values and not listing them in the list.

I want to control the listing at Matrix end. Alternatively, I have JS based solution which I am leaving to the last.

I also thought that I can use SSJS to compare the values and print them but SSJS doesn’t work in Asset listing.

Any suggestions?

Thanks in advance


(Bart Banda) #2

So you have a data source asset and you want to list assets from where the name of them matches a certain regex?

Have you tried using the Records Filter screen on the data source asset?

https://matrix.squiz.net/manuals/data/chapters/db-data-source#Record-Filter-Screen_record-filters

SSJS does work in asset listings.


(Harinder Singh) #4

Hi Bart, thanks for your reply.

I managed to make it work with asset listing using SSJS.

I tried to use Record filters with the following Regex expression but it was timing out and doesn’t filter any list.

^[A-Z\d\W]+$

FYI: I am using LDAP Data Source to list staff names.

Cheers