Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit b7b036a

Browse files
obonessavornicesei
authored andcommitted
Use the appropriate escape sequence in the regex to match end of lines
1 parent b551314 commit b7b036a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

project/core/sourcecontrol/PvcsHistoryParser.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ namespace ThoughtWorks.CruiseControl.Core.Sourcecontrol
1212
/// </summary>
1313
public class PvcsHistoryParser : IHistoryParser
1414
{
15-
private static Regex _searchRegEx = new Regex(@"(?<Archive>Archive:\s+.*?\r\n(.|\s)*?(={35}(\r\n|$)))", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
16-
private static Regex _archiveRegEx = new Regex(@"Archive:\s+(?<ArchiveName>.*?)\nWorkfile:\s+(?<Filename>.*?)\nArchive\screated:\s+(?<CreatedDate>.*?)\r\n(.|\s)*?-{35}\r\n(?<Revision>Rev\s\d+(\.\d+)*\r\n(.*\r\n)*?Author\sid:.*?\r\n((?!(={35}|-{35}))(.|\s)*?\r\n)?(-{35}|={35})(\r\n|$))+", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
17-
private static Regex _revisionRegEx = new Regex(@"Rev\s(?<Version>\d(\.\d+)*)\r\n(.*?\r\n)?Checked\sin:\s+(?<CheckIn>.*?)\r\n(.*?\r\n)?Last\smodified:\s+(?<PreviousModification>.*?)\r\n(.*?\r\n)?Author\sid:\s+(?<Author>.*?)\s.*?\r\n(Branches:\s+.*?\r\n)?(?<Comment>(((?!(={35}|-{35}))(.|\s)*?)\r\n)?)(={35}|-{35})(\r\n|$)", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
15+
private static string RegexNewLine = Regex.Escape(Environment.NewLine);
16+
17+
private static Regex _searchRegEx = new Regex(@"(?<Archive>Archive:\s+.*?" + RegexNewLine + @"(.|\s)*?(={35}(" + RegexNewLine + @"|$)))", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
18+
private static Regex _archiveRegEx = new Regex(@"Archive:\s+(?<ArchiveName>.*?)\nWorkfile:\s+(?<Filename>.*?)\nArchive\screated:\s+(?<CreatedDate>.*?)" + RegexNewLine + @"(.|\s)*?-{35}" + RegexNewLine + @"(?<Revision>Rev\s\d+(\.\d+)*" + RegexNewLine + @"(.*" + RegexNewLine + @")*?Author\sid:.*?" + RegexNewLine + @"((?!(={35}|-{35}))(.|\s)*?" + RegexNewLine + @")?(-{35}|={35})(" + RegexNewLine + @"|$))+", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
19+
private static Regex _revisionRegEx = new Regex(@"Rev\s(?<Version>\d(\.\d+)*)" + RegexNewLine + @"(.*?" + RegexNewLine + @")?Checked\sin:\s+(?<CheckIn>.*?)" + RegexNewLine + @"(.*?" + RegexNewLine + @")?Last\smodified:\s+(?<PreviousModification>.*?)" + RegexNewLine + @"(.*?" + RegexNewLine + @")?Author\sid:\s+(?<Author>.*?)\s.*?" + RegexNewLine + @"(Branches:\s+.*?" + RegexNewLine + @")?(?<Comment>(((?!(={35}|-{35}))(.|\s)*?)" + RegexNewLine + @")?)(={35}|-{35})(" + RegexNewLine + @"|$)", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
1820

1921
/// <summary>
2022
/// Parses the specified reader.

0 commit comments

Comments
 (0)