Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
37 Points
9 Posts
Oct 01, 2003 11:19 PM|LINK
using System; using System.Text.RegularExpressions; namespace ConsoleApplication1 { public class RegTest { static void Main(string[] args) { string inText = "link 1 - nobold test, link 2 - outBold, link 3 - innerbold"; string Pattern = @"(?ixn-ms: (?[^""]+)""\s*>)(?[^<]+)(?) )"; MatchCollection Matches = Regex.Matches(inText, Pattern, RegexOptions.IgnoreCase); foreach (Match NextMatch in Matches) { Console.WriteLine(NextMatch.Groups["tag"].ToString()); Console.WriteLine(NextMatch.Groups["href"].ToString()); Console.WriteLine(NextMatch.Groups["content"].ToString()); Console.WriteLine(NextMatch.Groups["closetag"].ToString()); Console.WriteLine(); } Console.ReadLine(); } } }
benricho
Member
37 Points
9 Posts
Re: Regular Expression help - parsing link tags
Oct 01, 2003 11:19 PM|LINK
using System; using System.Text.RegularExpressions; namespace ConsoleApplication1 { public class RegTest { static void Main(string[] args) { string inText = "link 1 - nobold test, link 2 - outBold, link 3 - innerbold"; string Pattern = @"(?ixn-ms: (?[^""]+)""\s*>)(?[^<]+)(?) )"; MatchCollection Matches = Regex.Matches(inText, Pattern, RegexOptions.IgnoreCase); foreach (Match NextMatch in Matches) { Console.WriteLine(NextMatch.Groups["tag"].ToString()); Console.WriteLine(NextMatch.Groups["href"].ToString()); Console.WriteLine(NextMatch.Groups["content"].ToString()); Console.WriteLine(NextMatch.Groups["closetag"].ToString()); Console.WriteLine(); } Console.ReadLine(); } } }I can't get this forum to pump out the code properly, there should be bold tags in the inText variable but it just makes the code bold.