Marcado de TextBox Obtener texto sin formato¿Alguien sabe cómo obtener el texto sin formato de un TextBox al que se le ha aplicado formato? Por ejemplo, en el ejemplo siguiente, me gustaría obtener el texto "Este texto está en negrita. Este texto está en cursiva. Este texto está subrayado. Este texto está en negrita, cursiva y subrayado." del cuadro (sin las directivas de formato).
Tengo un sistema que crea registros en la parte inferior de algunas aplicaciones que admite marcado (principalmente para fuente en negrita y roja), pero me gustaría poder guardar el registro en un archivo ocasionalmente y que no contenga las directivas de marcado.
¡Gracias!
Names Default To Here( 1 );
win = New Window( "Example", fontobj = text = Text Box( "Example Text" ) );
text << setText(
"This is <B>bold</B> text. This is <I>italic</I> text. This is <U>underlined</U> text. This is <B><I><U>bold, italic, underlined</U></I></B> text."
);
text << markup;
Ingeniería de Calidad y ProcesosRe: TextBox Markup Obtener texto sin formatoSolo me viene a la mente algún tipo de Regex, pero el patrón puede volverse molesto de construir
Names Default To Here( 1 );
win = New Window( "Example", fontobj = text = Text Box( "Example Text" ) );
text << setText(
"This is <B>bold</B> text. This is <I>italic</I> text. This is <U>underlined</U> text.
This is <B><I><U>bold, italic, underlined</U></I></B> text.
Text using a <FONT face="Vivaldi">different</FONT> font face.
Text using a <FONT size="16">different</FONT> font size.
This is <FONT color="Blue">blue</FONT> text. This is a <BACKGROUND color="yellow">yellow</BACKGROUND> background. This is <FONT color="#0000ff"><BACKGROUND color="0xffff00">blue text on a yellow background</BACKGROUND></FONT>."
);
text << markup;
Regex(text << get text, "()", "", GLOBALREPLACE);
Re: TextBox Markup Obtener texto sin formato¡Idea increíble!No se me había ocurrido usar expresiones regulares, pero eso es bastante ingenioso.