PoloDude Posted January 19, 2006 Share Posted January 19, 2006 I have an aspx page with msg's, everything is taken out of a db and parsed onto the page,i also parse some bb-tags like , ... during the rendering of the page.Now i'd like to add a tag for a list too, problem is, i can't figure out how to do that in asp.net (1.1) c#I've got these already:_msg = Regex.Replace(_msg, @"\[url src=(?<source>[^\]]+)\](?<text>[^\]]+)\[/url\]", @"<a href=""${source}"" target=""_blank"">${text}</a>");_msg = Regex.Replace(_msg, @"\[link src=(?<source>[^\]]+)\](?<text>[^\]]+)\[/link\]", @"<a href=""${source}"" target=""_blank"">${text}</a>");_msg = Regex.Replace(_msg, @"\[img src=(?<source>[^\]]+)\]", @"<img src=""${source}"" />");_msg = Regex.Replace(_msg, @"\[b\](?<source>[^\]]+)\[/b\]", @"<b>${source}</b>");So now i want something like above to make this:example 1example 2[list][*]example 1[*]example 2[/list]I hope some1 can help me out here Link to comment Share on other sites More sharing options...
jcarle Posted January 19, 2006 Share Posted January 19, 2006 You don't need to use RegEx for simple tags that have no parameters. Just use a straightforward Replace._msg = _msg.Replace("[list]", "<ul>");_msg = _msg.Replace("[*]", "<li>");_msg = _msg.Replace("[/list]", "</ul>"); Link to comment Share on other sites More sharing options...
PoloDude Posted January 19, 2006 Author Share Posted January 19, 2006 Yeah, i actually didn't think about that lol Thx, i'll think i've only got to use regex for the <li></li> part and that's not hard Thx for clearing my mind at this late hour Link to comment Share on other sites More sharing options...
jcarle Posted January 19, 2006 Share Posted January 19, 2006 Two heads is always better then one when it comes to coding. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now