-3

I have a string like below:

[quote="username"]This is a comment string[/quote]

Pattern 1: username Pattern 2: This is a comment string

Is it possible to replace this to get:

<div class="myclass">
   <b>username</b>
   <i>This is a comment string</i>
</div>

Thanks.

Ja͢ck
  • 166,373
  • 34
  • 252
  • 304
XTRUST.ORG
  • 3,019
  • 4
  • 32
  • 57

1 Answers1

0

Try

'[quote="username"]This is a comment string[/quote]'.replace(/\[quote="(.*?)"\](.*?)\[\/quote\]/, function(text, g1, g2, pos, content){console.log('a', g1, g2); return 'd'})
Arun P Johny
  • 376,738
  • 64
  • 519
  • 520