Fix osMatchString() so that it reports all instance of pattern matches, not just the first one.

This is a slight adaptation of the patch in http://opensimulator.org/mantis/view.php?id=4568 which doesn't apply directly since the underlying code was changed by earlier makopoppo patches.
Thanks makopoppo!
bulletsim
Justin Clark-Casey (justincc) 2011-07-09 01:24:30 +01:00
parent 52c3671aa0
commit f680c13495
1 changed files with 3 additions and 3 deletions

View File

@ -1909,8 +1909,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}; };
return NotecardCache.GetLines(assetID); return NotecardCache.GetLines(assetID);
} }
public string osAvatarName2Key(string firstname, string lastname) public string osAvatarName2Key(string firstname, string lastname)
@ -2024,7 +2022,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Find matches beginning at start position // Find matches beginning at start position
Regex matcher = new Regex(pattern); Regex matcher = new Regex(pattern);
Match match = matcher.Match(src, start); Match match = matcher.Match(src, start);
if (match.Success) while (match.Success)
{ {
foreach (System.Text.RegularExpressions.Group g in match.Groups) foreach (System.Text.RegularExpressions.Group g in match.Groups)
{ {
@ -2034,6 +2032,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
result.Add(new LSL_Integer(g.Index)); result.Add(new LSL_Integer(g.Index));
} }
} }
match = match.NextMatch();
} }
return result; return result;