Например:
"auroraa1Smile", "auroraa1Bye", "auroraa1Love"
Мне нужно иметь возможность получить весь код для данного смайла без каких-либо пробелов до/после и изменить его. это.
В таком предложении, как:
Код: Выделить всё
"Hello Aurora! auroraa1Smile How are you?"
Код: Выделить всё
"Hello Aurora! [emote:4771491:auroraangel79Smile] How are you?"
Как создать регулярное выражение для захвата кода смайла из исходной строки: auroraa1Hi
Мой текущий код:
Код: Выделить всё
//read the twitchMsg and look for "auroraa1" which denotes an emote
string wordToFind = "auroraa1";
string kickMsg = "NONE";
kickMsg = CPH.GetGlobalVar("s_msg");
// Find all occurrences of the wordToFind as a whole word
MatchCollection matches = Regex.Matches(kickMsg, $@"{wordToFind}", RegexOptions.IgnoreCase);
if (matches.Count > 0)
{
CPH.SendMessage($"'{wordToFind}' found {matches.Count} times as a whole word.");
foreach (Match match in matches)
{
CPH.SendMessage($"Found at index: {match.Index}");
}
}
else
{
CPH.SendMessage($"'{wordToFind}' not found as a whole word.");
}
return true;
Код: Выделить всё
'auroraa1' found 1 times as a whole word.
Found at index: 28
Подробнее здесь: https://stackoverflow.com/questions/798 ... eplacement
Мобильная версия