Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SVNParse
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here string input = "U bla.txt<br/>U mail1.txt<br/>U montest.txt<br/>A qdfgsrg.txt<br/>A sfssdf.txt<br/>"; string globalPattern = "(.*?)<br\\/>"; MatchCollection matches = Regex.Matches(input, globalPattern); Console.WriteLine("Matches found: {0}", matches.Count); List<string> updated = new List<string>(); List<string> added = new List<string>(); if (matches.Count > 0){ Console.WriteLine("All files"); foreach (Match m in matches){ Console.WriteLine(": {0}", m.Groups[1]); string actionPattern = "^([U,A]{1})\\s*(.*?)$"; MatchCollection matches2 = Regex.Matches(m.Groups[1].Value, actionPattern); if (matches2.Count > 0){ switch (matches2[0].Groups[1].Value){ case "U": updated.Add(matches2[0].Groups[2].Value); break; case "A": added.Add(matches2[0].Groups[2].Value); break; } } } var resultUpdated = String.Join(", ", updated.ToArray()); Console.WriteLine("Updated Files :"); Console.WriteLine(resultUpdated); var resultAdded = String.Join(", ", added.ToArray()); Console.WriteLine("Added Files :"); Console.WriteLine(resultAdded); } } } }
run
|
edit
|
history
|
help
0
Task 1_4
project euler 14, C#
adxasxsd
s
int array element change with xor
otro
SquareRealMatrixWithMathJax
Linked Lists
Code wall rules
practice program