Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

String Param tag replace with Br tag

Community Beginner ,
Sep 06, 2014 Sep 06, 2014

original text:

<P ALIGN="LEFT">sample text1</P><P ALIGN="LEFT">sample text2</P><P ALIGN="LEFT">sample text3</P>

I need to: <br/>sample text1<br2>sample text2<br2>sample text3

can help me

TOPICS
ActionScript
869
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 07, 2014 Sep 07, 2014

Have you tried...

<br>sample text1<br>sample text2<br>sample text3

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2014 Sep 07, 2014

No

Is it possible.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 07, 2014 Sep 07, 2014

Try.

What code are you using to assign this text to the textfield?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2014 Sep 07, 2014

Thank you for Quick reply,

I have tried today whole day but no result. I will show one of my code.

Below code i am getting bouble break but i need only one break.

var reg:RegExp = /\<\/?P.*?\/?\>/igm;

  var _m=messageField.htmlText

  _m=_m.replace(reg, '<br/>');

trace(_m) //  "<br/>sampletext1<br/><br/>sampletext2<br/><br/>sampletext3<br/>"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 07, 2014 Sep 07, 2014

You are getting doublke breaks because your text is showing double breaks.  Every <br/><br/> you see will break twice.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 07, 2014 Sep 07, 2014

Mhybe what you want to do is to only replace the </P> <P ... > sequences with the <BR> tag instead of every tag with a P in it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2014 Sep 07, 2014

var reg:RegExp = /\<\/?P.*?\/?\>/igm;

  var _m=messageField.htmlText//<P ALIGN="LEFT">sample text1</P><P ALIGN="LEFT">sample text2</P><P ALIGN="LEFT">sample text3</P>

  _m=_m.replace(reg, '<br/>');

trace(_m) //  "<br/>sampletext1<br/><br/>sampletext2<br/><br/>sampletext3<br/>"

Iam getting double breaks i need only one break.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 07, 2014 Sep 07, 2014

As I indicated in my last response you probably want to be replacing the apir of tags, not individual ones.  change you regular expression to do that

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2014 Sep 07, 2014

I tried But no usefull.

Can give code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 08, 2014 Sep 08, 2014
LATEST

What did you try?  The following does what I said you should do...

var reg:RegExp = /\<\/P\>\<P.*?\/?\>/igm;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines