If you put multiple tags in one node body, the regular expression fails to select them properly - it matches and selects the start of the first tag through to the end of the second tag.

Example bit of text:

<p>A [node:1,title="link to node 1"] and also a [node:2,title="link to node 2"] in one node body.</p>

It is currently this:
/\[node:(\d+)(.*)\]/i

Testing that using preg_match at http://www.perfectweb.com/resources/preg_match.php:

the string was matched as follows
Array
(
    [0] => [node:1,title="link to node 1"] and also a [node:2,title="link to node 2"]
    [1] => 1
    [2] => ,title="link to node 1"] and also a [node:2,title="link to node 2"
)

I find this regex works better, as it accepts any character inside the attributes string except a closing square bracket:

/\[node:(\d+)([^\]]*)\]/i

But I don't think it will work if you have a closing square bracket inside an attribute string. I can live with that but the dev(s)? may want to come up with something more robust for the module.

Comments

TomChiverton’s picture

Status: Reviewed & tested by the community » Fixed

I can't thing of a more sensible way of supporting multiple tags, updated in newer builds.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.