Hey guys, was wondering if anyone can tell me how or what I am doing wrong here.

Now I am not guru with the regexp but I don’t see what the problem is, what I have at the moment is this.

(?s)(.)(

`[code])(.)([/code]`
)(.*)

Now my understanding is that the (?s) means single line, so when I change that to (?m) I expect it would or should work over multiple lines, but it doesn’t seem to work.

The problem I have is that I am trying to take either of the following

`[code][code]`
```[code]

[code]```
```[code]

[code]

```

And lastly

```[code brush=””]

[code]

```

Anyone have any clues?

here you go:

(<pre>[\t\r\n]*?\[code(\sbrush(\s)*?=(\s)*?"(.*"))*?\(\s)*?])([.\r\n\t]*?)(\[code\][\t\r\n]*?</pre>)

im using this application, its really handy for regexes.
http://www.regexbuddy.com/

or use this one, which is a bit more flexible with whitespace;

(<pre>[\t\r\n\s]*?\[code(\sbrush(\s)*?=(\s)*?"(.*"))*?\(\s)*?])([.\r\n\t]*?)(\[code\][\t\r\n\s]*?</pre>)

Cheers when I stuck that in I am getting unmatched parentheses .

front of the escape \ symbol.

this is the right one:

(<pre>[\t\r\n\s]*?\[code(\sbrush(\s)*?=(\s)*?"(.*"))*?(\s)*?\])([.\r\n\t]*?)(\[code\][\t\r\n]*?</pre>)

Thanks this ended up working a charm, I did make one change so it ended up being.

(?si)(

`[\t\r\n\s]?[code(\sbrush(\s)?=(\s)?""(.?)"")?(\s)?])(.?)([/code][\t\r\n\s]?`
)

Again thanks for this.