On April 18, last year in the Server user group meeting, a developer mentioned interest in implementing BUG-4906.
Since that time, a synchronous notecard line reading function was implemented.
Still, interest in implementing notecard text find/count functions continued.
Since we now have a synchronous notecard line reading function, I feel it is necessary to update the spec of how find/count functions should work.
list llNotecardTextFind(string name, string pattern, integer start, integer count, list options)
The above function works similar to llLinksetDataFindKeys() in that it uses regex and synchronous return.
Instead of keynames, notecard line numbers/columns where line data matched pattern are returned instead.
If name is not in inventory nor a UUID, start is outside of notecard line count or no matches found, this function returns an empty list.
If notecard data is not cached, a list containing NAK is returned.
With a list of notecard lines where matches were found, llGetNotecardLineSync() can used to read line data synchronously as well.
string name - Name of notecard in inventory or UUID
string pattern - A regular expression describing which notecard line numbers/columns to return.
integer start - The first occurrence of pattern to return.
integer count - The number of occurrences of pattern to return from start.
list options - Provision for optional inputs and a modular means of updating the functionality of this function in the future.
One Linden mentioned wanting the means of including occurrence counts with line numbers.
Another Linden mentioned the desire for case sensitive searches.
Another method could be a way to look for blank only.
The options param would allow for this work to be added in a follow-up.
integer llNotecardTextCount(string name, string pattern, list options)
The above function works similar to llLinksetDataCountFound() in that it uses regex and synchronous return.
A count of the number of matches made is returned.
If more than one match is found on a line, the match count is used, not 1, so the overall count can potentially be greater than number of notecard lines.
string name - Name of notecard in inventory or UUID
string pattern - A regular expression describing which notecard line numbers to return.
list options - Provision for optional inputs and a modular means of updating the functionality of this function in the future.
This is the safe means of checking for presence of search terms in notecards without worry of stack-heaping the script.
If a count is returned that could stack-heap a script, a looped alternative can then be made using llNotecardTextFind() with an incremented start param and lower count param.