SL regex doesn't appear to support unicode hex value range input, only single values.
tracked
Lucia Nightfire
[\x00-\x7f] or [\x00-\x7F] doen't work.
\x##, where # is a hex value, does.
[\x00-\x7f] is legal in regex outside of SL.
Log In
Maestro Linden
tracked
Maestro Linden
I believe I can reproduce this with the script shown below in Second Life Server 2024-07-22.10048683488. The output I see with this script is:
Test case #: 0 llLinksetDataFindKeys("Thing", 0, 0) returned: ThingA_config
Test case #: 1 llLinksetDataFindKeys("[\x00-\x7f]", 0, 0) returned: ThingA_config, thingB_config
Test case #: 2 llLinksetDataFindKeys("[\x00-\x7f]hing", 0, 0) returned: ThingA_config
Test case #: 3 llLinksetDataFindKeys("[\x00-\x7F]", 0, 0) returned: ThingA_config, thingB_config
Test case #: 4 llLinksetDataFindKeys("[\x00-\x7F]hing", 0, 0) returned: ThingA_config
Test case #: 5 llLinksetDataFindKeys("[\x00-\x7f]nomatch", 0, 0) returned:
Test case #: 6 llLinksetDataFindKeys("[\x00-\x7F]nomatch", 0, 0) returned:
Test case #: 7 llLinksetDataFindKeys("[\x53-\x55]hing", 0, 0) returned: ThingA_config
Test case #: 8 llLinksetDataFindKeys("[\x54-\x54]hing", 0, 0) returned: ThingA_config
Test case #: 9 llLinksetDataFindKeys("[\x56-\x58]hing", 0, 0) returned: ThingA_config
integer testCase;
printAllMatchingKeys(string pattern)
{
list keys = llLinksetDataFindKeys(pattern, 0, 0);
llOwnerSay("Test case #: " + (string)(testCase++) + " llLinksetDataFindKeys(\""
+ pattern + "\", 0, 0) returned: " + llList2CSV(keys));
}
default
{
state_entry()
{
llLinksetDataWrite("ThingA_config", "value");
llLinksetDataWrite("thingB_config", "value");
printAllMatchingKeys("Thing");
printAllMatchingKeys("[\\x00-\\x7f]");
printAllMatchingKeys("[\\x00-\\x7f]hing");
printAllMatchingKeys("[\\x00-\\x7F]");
printAllMatchingKeys("[\\x00-\\x7F]hing");
printAllMatchingKeys("[\\x00-\\x7f]nomatch");
printAllMatchingKeys("[\\x00-\\x7F]nomatch");
// 0x54 = ASCII "T"
printAllMatchingKeys("[\\x53-\\x55]hing");
printAllMatchingKeys("[\\x54-\\x54]hing");
printAllMatchingKeys("[\\x56-\\x58]hing"); // should not match - specified character range is V-X
}
}
Maestro Linden
I believe it's a bug that test case #9 finds 'ThingA_config' from the search, as the specified byte range of "[\x56-\x58]" for the first character should mean ascii "V-X", which does not include "T". The documentation at https://wiki.secondlife.com/wiki/Template:LSL_Regular_Expressions describes "\xdd" is valid notation for character values, so parsing ranges of these values should work.
No match is detected by https://regex101.com when the case #9 test strings are used.
I think the script has a parsing error and is instead looking characters in the ASCII "6" to "\" range, which includes every capital letter. This is why case 9 doesn't find the 'thingB_config' key, as "t" comes before "6" in ASCII.
Maestro Linden
under review