Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Fórum ➡ Finding STRONG tags that contain UL tags, using Regex class♦
//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; // aljodav // http://rextester.com/users/376 // in reply to the thread // https://social.msdn.microsoft.com/Forums/WindowsServer/en-us/ecf63c6b-cbb0-4f3c-8025-2c525082c486/regular-expression-question-what-is-the-regular-expression-for-my-search?forum=csharpgeneral namespace Rextester { public class Program { public static void Main(string[] args) { // SINGLE LINE STRINGS ONLY! string test="<p>red green <strong>blue</strong> cyan <strong><ul><li>Sun</li><li>Mercury</li></ul></strong> magenta <strong>yellow</strong> orange <strong><ul><li>Venus</li><li>Earth</li></ul></strong>"; string patt1="<strong.+?/strong>"; string patt2="<ul.+?/ul>"; // NOTICE ➡ it is QUITE SIMPLE! foreach(Match m in Regex.Matches(test,patt1)){ Console.WriteLine( Regex.Match(m.Value,patt2).Success?m.Value:"" ); } Console.WriteLine("\n\nHello, world! :P"); } } }
run
|
edit
|
history
|
help
0
532
Trent Butler All Dead Example
Swap w/o third var
D18
partial
Coding Exercise
C Triangle
enum flag comparison
wyliczenie 1 dnia tygodnia
type comparison