J2M icon indicating copy to clipboard operation
J2M copied to clipboard

Multiple bold or italic sections in one string are not handled properly

Open aantonovich opened this issue 6 years ago • 1 comments

String like "test str _first italic section_ some text _second italic section_ some later text" handled like "test str first italic section_ some text _second italic section some later text" Same problem related to bold sections. To fix it regex should be corrected: Instead of

        // Bold
        .replace(/\*(\S.*)\*/g, '**$1**')
        // Italic
        .replace(/\_(\S.*)\_/g, '*$1*')

Should be

        // Bold
        .replace(/\*(\S[^*]*)\*/g, '**$1**')
        // Italic
        .replace(/\_(\S[^_]*)\_/g, '*$1*')

aantonovich avatar Oct 31 '17 08:10 aantonovich