Regex pattern issue in Identitynow search

Hey team, when I search for identities based on attributes using the regex pattern, I am not getting the proper response.
the regex pattern is right and it working outside the identity now. Eg. to filter the display name which starts with ‘Ra’ we usually use /\bRa./* but the same is not working in search.

could anyone please help me out with this?

Hi Varunraj and welcome to the Developer Community. Did you review this? How to use regex with Search in IdentityNow - Compass

Yes @rasmus_lund, the regex pattern shown in the link is working, but when we write a custom pattern, the application is not able to parse it.
Can you please suggest a working pattern to filter identity based on the first 2 characters? eg. I want to filter all name starts with ‘RA’.

1 Like

Rather than use explicit regex, you can use the simple matching syntax.

attributes.displayName:RA*

This will match all display names that start with RA and have any number of characters after it.

1 Like

It looks like the main issue with your regex expression is the capital ‘R’. In doing some testing, I found out that the search does not respect the capitalized letters and only works with lower case letters in Regex. If you change it to /ra.*/ then you should pick up the users that you are looking for. I have a topic discussion started on this at the link below.

Additionally, it looks like you have a typo in your regex patter above. You have /\bRa./* when I believe you meant /\bRa.*/

Also, it looks like Elasticsearch does not handle anchor tags, per the last paragraph in this document, and rather always anchors to the start of the word.

Discussion on issue:

Thanks for pointing this out Geoff. I did some more digging and it looks like the default behavior of search is to ignore case and only work with lowercase letters in the search query. If you need case sensitivity, it looks like using the .exact keyword will enable that.

For example, if I need to find all identities with a display name that starts with Aa (ex. Aaron) then the following queries will honor the case sensitivity.

attributes.displayName.exact:/Aa.*/
attributes.displayName.exact:Aa*

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.