Get text without bbcode in RichTextLabel

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By megalukes

Hello everyone,

I’m working on a message system for my project and I encountered an issue regarding bbcode text that’s been bugging me for a while. Is there a way to get bbcode text without tags in a simple string?

For instance, this is my bbcode text:

"[b]CharacterName:[/b] Conversation."

I’d like to know if there’s a method that could possibly return this as a String:

"CharacterName: Conversation."

I need this because I’d like to make parts of the text visible before others (for instance: the character’s name would appear at once, while what he talks about is shown character by character). I know I can do this using two different labels, but I’d like to process a single String with regexp for my message system.

Thanks in advance!

:bust_in_silhouette: Reply From: Calinou

This is not available in core yet, but there’s a pull request adding this feature: Add strip_bbcode() method to String by ztc0611 · Pull Request #65839 · godotengine/godot · GitHub

A workaround using a regex is listed here: Add a function to erase BBCode from a String, without depending on RichTextLabel · Issue #5056 · godotengine/godot-proposals · GitHub