Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action Script 3.0 replace all occurrences in multiline String

I have some text:

1. Lorem &laquo;ipsum&raquo; dolor sit amet, consectetur<br/>
2. adipisicing &laquo;elit&raquo;, sed do eiusmod tempor<br/>
3. incididunt ut &laquo;labore&raquo; et dolore magna aliqua.<br/>

And I want to replace all "&amp;laquo;" to "&amp;#171;" and all "&amp;raquo;" to "&amp;#187;".

This replace only in first row:

txt.replace(new RegExp("&amp;laquo;","gi"),"&amp;#171;").replace(new RegExp("&amp;raquo;", "gi"),"&amp;#187;");

other rows still not changed.

What I am doing wrong?

like image 562
Eazy Avatar asked Sep 03 '13 06:09

Eazy


1 Answers

Make your regex 'multiline':

new RegExp("&amp;laquo;","gim")
like image 166
Tair Avatar answered Sep 19 '22 06:09

Tair