Regex for removing a specific BBCode from a string

前端 未结 3 1854
陌清茗
陌清茗 2021-01-20 11:27

I\'m trying to write a simple method for removing specific BBCodes from an input string.

For example, where I have an input of:

string input = \"[b]H         


        
3条回答
  •  被撕碎了的回忆
    2021-01-20 12:01

    The below regex would capture the string Hello World! inside the second group.

    ^(.*?)((?<=])[^[]*)(.*)$
    

    DEMO

    So replace all your input string with the second captured group.

提交回复
热议问题