It's been a long time ... so I'm just copy-posting something I did years ago ... that just looks to me like it's related. Maybe it will give you a hint about something to try. I would have to go back and review regular expressions again to be any more helpful.
re= new RegExp("<br>|<br/>","gi"); article=article.replace(re,"\r\n"); [ April 24, 2007: Message edited by: Roger F. Gay ]
Originally posted by Gayatri Sinha: why is the new line ignored?
Because that's the way HTML works. Whitespace is not literally interpreted.
If you put the following in your HTML:
It will all appear on one "line". Whitespace is not that important, and newline has no semantics.
Surprisingly, this works -
Actually, your code example does not work. if you put an alert after the call to replace, you will see that all but the first <br/> tags remain in your string. [ April 24, 2007: Message edited by: Bear Bibeault ]
Roger F. Gay
Joined: Feb 16, 2007
Sorry Gayatri. I guess I was distracted by the detailed. Check the ASCII table at