Curtis
Curtis

Reputation: 103348

Replace [b]xxx[/b] with 'xxx' in bold

How can I convert [b]xxx[/b] to <strong>xxx</strong> using VB.NET Regex.Replace()?

Thanks.

Upvotes: 3

Views: 3106

Answers (2)

kͩeͣmͮpͥ ͩ
kͩeͣmͮpͥ ͩ

Reputation: 7846

Regex.Replace("\[b\](.*?)\[\/b\]", "<strong>$1</strong>") would do it

However, you don't need regex:

"[b]xxx[/b]".Replace("[b]","<strong>").Replace("[/b]","</strong>")

Upvotes: 6

Josh Lee
Josh Lee

Reputation: 177594

Just use a BBCode parser that someone else has written. It’s safer and more robust.

Upvotes: 7

Related Questions