I want to get the value of the background attribute (background.jpg) inside square bracket like BBCode editor's and I tried this regexp 

```
\[(\w+)[^\]]*](.*?)\[\/\1]/g 

```

but it didn't work.

```
[code background="background.jpg"] Here some text [/code]

```