javascript - Only Match Words That Are Outside of Certain Tags (Regex-JS) -


i working on writing own bbcode parser. very new writing regexs.

i trying make regex match tags, except if inside of code or quote tag. here mean:

[b] text bolded [/b]  [code][b] text not bolded [/b][/code] [quote][b] text not bolded [/b][/quote] 

problem is matching text should not bolded...

here regex:

/((?!\[code\]) \[b\](.*)\[\/b\] (?!=\/code\]))/gi 

and can find working example here: https://regex101.com/r/oi3mn8/2

so question is, how can make grab correct stuff?

p.s. how can make grab each chunk? right grabbing first , last. example:

[b] text should bolded [/b] text should not bolded, still is. [b] text should bolded again [/b] 

it reason grabbing first , last tags, why?


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -