Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Mintra url string replace
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { private static readonly Regex configValueExtrator = new Regex(@"^((?:http|https)://[^\{]*)({id})(/startCourse)"); private static readonly string config = "https://test.mintra.no/mintra/sso/directAccess/{id}/startCourse"; private static readonly string enrollmentId = "f7848557-27da-4423-a44e-0a0adab93a08"; public static void Main(string[] args) { var matches = configValueExtrator.Matches(config); var url = config.Replace("{id}", enrollmentId); Console.WriteLine("Url: {0}", url); foreach(Match match in matches){ Console.WriteLine("**MATCH**"); Console.WriteLine(match.Value); foreach(Group grp in match.Groups){ Console.WriteLine("\t**GROUP**"); Console.WriteLine("\t{0}", grp.Value); foreach(Capture capture in grp.Captures){ Console.WriteLine("\t\t**Capture**"); Console.WriteLine("\t\t{0}", capture.Value); } } } } private static bool _restrict = true; public static bool Restrict { get{ return _restrict;} private set { _restrict = value; } } private static List<string> _validRecipients = new List<string>(); public static IEnumerable<string> ValidRecipients { get { return _validRecipients; } private set { _validRecipients = value.ToList(); } } public static void ParseConfigString(string config) { var matches = configValueExtrator.Matches(config); if (matches.Count < 1) { return; } var match = matches[0]; if (match.Groups.Count < 3) { return; } _restrict = !match.Groups[1].Value.Equals("false"); foreach (Capture capture in match.Groups[2].Captures) { _validRecipients.Add(capture.Value); } } } }
run
|
edit
|
history
|
help
0
Math
Find Max Number Of Occurences in an int array
Chris Kasongo Lazarius Mukengeshayi "Entelect BlackJack 21"
kjk
Dependency Injection
Número primers
Bitwise Shifting for Strings
Carnival 1.0
The abstract factory design pattern implemented in c# using generics.
ReverseArrayC#