I am trying to convert the following PHP REGEX into JavaScript:
$article_f = preg_replace('#\[b\](.+)\[\/b\]#iUs', '<b>$1</b>', $article_text);
I have come up with the following JavaScript:
article_f = article_f .replace(/\[b\](.+)\[\/b\]/gi, '<b>$1</b>');
For some reason this is allowing a match to go ignored if it is on the same line as another match, it will actually combine them into one large match, e.g.:
[b] this is bold[/b] and [b] this is too [/b]
Will be replaced with
<b> this is bold[/b] and [b] this is too </b>
Any ideas one how to fix this would be greatly appreciated.