0

I'm developing a chrome and firefox extension and i'm stuck with matching a certain tag and content inside of that. Can you please help me out?

Code:

[QUOTE=UserAdmin;22061013]
  [SIZE="4"]
    [LEFT]
      [COLOR="DarkGreen"] Sample text goes here [/COLOR]
    [/LEFT]
  [/SIZE]
[/QUOTE]

Here i'd like to match beginning of [QUOTE= because everything what comes after that will be totally different each time and finally by the closing tag of [/QUOTE]

I'm not a regex expert and here is what i've came up with:

const regex = /^(\[QUOTE=)/;
const str = "[QUOTE=UserAdmin;22061013][SIZE="4"] [LEFT] [COLOR="DarkGreen"] Sample text goes here [/COLOR] [/LEFT] [/SIZE][/QUOTE]";

It successfully matched as below but i'm not sure this is the correct way of doing it:

regex matched image

If i can have a regex code to match whatever inside the [QUOTE=]....[/QUOTE] tag and save it to later use would be highly appreciated.

Online regex fiddle link

CodeMonkey
  • 2,828
  • 1
  • 23
  • 32

1 Answers1

2

Try this

\[QUOTE=[\s\S]+\[\/QUOTE\]
tchelidze
  • 8,050
  • 1
  • 29
  • 49