Regex in Search not respecting case

While reviewing topics here related to Search and using Regex, I noticed a that the search does not respect case in Regex.

The topic I was looking at was this one: Regex pattern issue in Identitynow search

And the document that was provided was the “How to use Regex with Search in IDN” found here: How to use regex with Search in IdentityNow - Compass

While testing out the examples from the document and the issue the user in the other topic was having I noticed that the search was not respecting case when put into the search. Actually, it was not returning anything when you used Capitals within the search regex expressions.

For my tenant, we have the standard demo user “Ashley.Simpson”. I used the following searches to locate this user:

Simple matching syntax:
attributes.displayName:As* - Worked
attributes.displayName:as* - Worked

Regex:
attributes.displayName:/as.*/ - Worked
attributes.displayName:/[a]s.*/ - Worked
attributes.displayName:/As.*/ - DID NOT WORK
attributes.displayName:/[A]s.*/ - DID NOT WORK

So it looks like if you try and use a Regular Expression with a Capital in it, it will not return any results. I looked over the documentation linked and there is no mention of case being an issue with Regex either, so this seems like a possibly bug or undocumented feature.

Hey Geoff. Thanks for pointing this out, as it is not intuitive what you need to do in order to enable case sensitivity. Please see this post for how to search when case matters.

Thanks for the additional details that were posted in the other article. I reviewed both the original link you posted there and the new link you posted. Neither of those links (or the search section of the second one) mention that the default behavior is to only use lower case, nor is there a mention that if you use upper case, that the search will fail to return results, even if you have data that would match the search. This seems like an area for improvement in the documentation at minimum.

Additionally, the use of the “.exact” keyword will not work for other fields outside the specified ones, For Example the department field, which has a value of “Doctors”.

attributes.department:do* - Works
attributes.department:Do* - Works

attributes.department:/do./ - Works
attributes.department:/Do.
/ - Does Not Work
attributes.department.exact:/Do.*/ - Does Not Work

Is there a recommended approach to handle this situation if the Regex is needed with case-sensitivity?

Agreed. This behavior could be better called out. I have opened a docs ticket to have them look into a better way to explain the default behavior.

As for your issue with department, the docs state that the .exact keyword is available for use with the following fields and field types:

  • name
  • displayName
  • lastName
  • firstName
  • description
  • All identity extended attributes
  • Other free text fields

This means you should be able to use it for any identity attribute and other free form text fields. For what it’s worth, I also tested this on a department field and was able to successfully search based on upper case.

I just double checked, and it does look like I can search using the .exact keyword for department. I must have had a typo in there.

Thanks for working through this.

Just wanted to share that the docs team has updated the search docs to be more explicit about how case sensitivity works and when to use .exact. This should be clearer for future readers.

1 Like

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