Replace [b] xxx [/ b] with “xxx” in bold

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

Thank.

+3
source share
2 answers

Just use the BBCode parser that someone else wrote. It is safer and more reliable.

+7
source

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

However, you do not need a regex:

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

+6
source

Source: https://habr.com/ru/post/1772857/


All Articles