private bool TrySeekSection(Regex sectionNameRegex, ref int lineNumber, out string sectionName)
{
string currentSectionName = null;
while (SeekSection(ref lineNumber, out currentSectionName) &&
!sectionNameRegex.IsMatch(currentSectionName))
{
lineNumber++;
}
sectionName = currentSectionName;
return currentSectionName != null && sectionNameRegex.IsMatch(currentSectionName);
}