Likes a bug.
However, your double-cycle is a bit strange.
Here is more clear test:
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <regex>
Regex regex;
char loremipsum[] = {
"<STEAM_0:1:23456> Baca bacardi jump over brown fox \
STEAM_7:8:9012345678 rolling down the hill, hit his head on rock"
};
public void OnPluginStart()
{
char buf[128];
regex = new Regex("STEAM_\\d:\\d:\\d+");
int numMatches = regex.MatchAll(loremipsum);
if( numMatches )
{
PrintToServer("Full string: \"%s\"\n", loremipsum);
PrintToServer("Num of matches: %i\n", numMatches);
for(int iMatch = 0; iMatch < numMatches; iMatch ++)
{
int offsetMatch = regex.MatchOffset(iMatch);
regex.GetSubString(0, buf, sizeof(buf), iMatch);
PrintToServer("[substring:%i, offs:%i, len:%i]: %s", iMatch, offsetMatch, strlen(buf), buf);
}
}
}
Quote:
Full string: "<STEAM_0:1:23456> Baca bacardi jump over brown fox STEAM_7:8:9012345678 rolling down the hill, hit his head on rock"
Num of matches: 2
[substring:0, offs:16, len:15]: STEAM_0:1:23456
[substring:1, offs:71, len:20]: STEAM_7:8:9012345678
|
__________________