function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
benito dardobenito dardo 

search wildcard string (question marks) in SOSL

Hi !

I would like to perform a SOSL and search for the string "????".

By reading the doc I understood I have to escape it and surround it with doble quotes

 

string searchString = '"\\?\\?\\?"';
string s = 'FIND \''+ searchString +'\' IN ALL FIELDS RETURNING Case(Id,Subject,Description,LastModifiedDate,Status,Priority WHERE IsClosed = false ORDER BY LastModifiedDate DESC) LIMIT 100';

List<List<SObject>> auxSearchList = new List<List<SObject>>();

 

As a result I'm getting "Invalid string literal '\?\?\?'. Illegal character sequence '\?' in string literal"

 

I have also tries with :

'\?\?\?'

'???'

... and other combinations, but I get different errors like "search term must be longer than one character: ???"

 

Thanks in advance.