if (runtextpos > runtextbeg && runtext![runtextpos - 1] != '\n')
{
int newline = runtext.IndexOf('\n', runtextpos);
- if (newline == -1)
+ if (newline == -1 || newline + 1 > runtextend)
{
runtextpos = runtextend;
return false;
if (!_code.LeadingCharClasses[0].CaseInsensitive)
{
// singleton, left-to-right, case-sensitive
- int i = runtext.AsSpan(runtextpos, runtextend - runtextpos).IndexOf(ch);
+ int i = span.IndexOf(ch);
if (i >= 0)
{
runtextpos += i;
// Using beginning/end of string chars \A, \Z: Actual - "\\Aaaa\\w+zzz\\Z"
yield return new object[] { @"\Aaaa\w+zzz\Z", "aaaasdfajsdlfjzzza", RegexOptions.None, 0, 18, false, string.Empty };
+ // Anchors and multiline
+ yield return new object[] { @"^A$", "ABC\n", RegexOptions.Multiline, 0, 2, false, string.Empty };
+
// Using beginning/end of string chars \A, \Z: Actual - "\\Aaaa\\w+zzz\\Z"
yield return new object[] { @"\A(line2\n)line3\Z", "line2\nline3\n", RegexOptions.Multiline, 0, 12, true, "line2\nline3" };
}
};
- // Mutliline
+ // Multiline
yield return new object[]
{
"(line2$\n)line3", "line1\nline2\nline3\n\nline4", RegexOptions.Multiline, 0, 24,
}
};
- // Mutliline
+ // Multiline
yield return new object[]
{
"(line2\n^)line3", "line1\nline2\nline3\n\nline4", RegexOptions.Multiline, 0, 24,
}
};
- // Mutliline
+ // Multiline
yield return new object[]
{
"(line3\n$\n)line4", "line1\nline2\nline3\n\nline4", RegexOptions.Multiline, 0, 24,
}
};
- // Mutliline
+ // Multiline
yield return new object[]
{
"(line3\n^\n)line4", "line1\nline2\nline3\n\nline4", RegexOptions.Multiline, 0, 24,
}
};
- // Mutliline
+ // Multiline
yield return new object[]
{
"(line2$\n^)line3", "line1\nline2\nline3\n\nline4", RegexOptions.Multiline, 0, 24,