int przedrostek = 13; bool containsMagazyn = Regex.IsMatch(text,…
- User
int przedrostek = 13;
bool containsMagazyn = Regex.IsMatch(text, @"\b"+przedrostek+@"\d{2}/(.*)\b"); if (containsMagazyn) { int count = Regex.Match(text, @"\b" + przedrostek + @"\d{2}/(.*)\b").Groups.Count; _magazyn = Regex.Match(text, @"\b" + przedrostek + @"\d{2}/(.*)\b").Groups[0].Value; text = Regex.Replace(text, @"\b" + przedrostek + @"\d{2}/(.*)\b", @""); } else { bool containsMagazyn2 = Regex.IsMatch(text, @"\b" + przedrostek + @"\d{2}"); if (containsMagazyn2) { int count = Regex.Match(text, @"\b" + przedrostek + @"\d{2}").Groups.Count; _magazyn = Regex.Match(text, @"\b" + przedrostek + @"\d{2}").Groups[--count].Value; text = Regex.Replace(text, @"\b" + przedrostek + @"\d{2}", @""); } }DODAJ ZE _MAGAZYN MUSI MIEC 4 LICZBY LUB WIĘCEJ GDY ZAWIERA ZNAK "/"
- Assistant
The existing regular expressions you have will match a sequence as defined by the
przedrostekvariable followed by two digits and, in the first case, a slash and any characters until a word boundary is reached, and in the second case, just two digits followed by a word boundary.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.