DasRed/js-bbcode-parser

Code parsing doesn't work across multiple lines

Closed this issue · 0 comments

JL102 commented

If you put code like this:

[list]
[*]item 1[/*]
[*]item 2[/*]
[/list]

[b]
multi line
bold text
[/b]

the output will be as follows:

[list]

  • item 1
  • item 2

[/list]
[b] multi line bold text [/b]

It can be solved by adding an "s" to the regex flags on lines 41 and 59: new RegExp(regex, 'igms'). The "s" flag lets the regex search across multiple lines (see https://stackoverflow.com/questions/159118/how-do-i-match-any-character-across-multiple-lines-in-a-regular-expression)