Not attaching Multiple Nodes

dplabs - September 1, 2006 - 14:24
Project:Attached Node
Version:4.7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I had multiple tags like [node:8] [node:10] [node:11] in the body of my page, and it was only seeing the first one. Upon looking at the RegEx is was too general and was returning an array like

array(3) {
  [0]=>
  array(1) {
    [0]=>
    string(28) "[node:8] [node:10] [node:11]"
  }
  [1]=>
  array(1) {
    [0]=>
    string(1) "8"
  }
  [2]=>
  array(1) {
    [0]=>
    string(1) "1"
  }
}

I modified line 100

$meta_tag_regexp = '/\[node:(\d+)*(.*)\]/i';

changed to to

$meta_tag_regexp = '/\[node:(\d+)*(,\s*.+)\]/i';

results now look like

array(3) {
  [0]=>
  array(3) {
    [0]=>
    string(8) "[node:8]"
    [1]=>
    string(9) "[node:10]"
    [2]=>
    string(9) "[node:11]"
  }
  [1]=>
  array(3) {
    [0]=>
    string(1) "8"
    [1]=>
    string(2) "10"
    [2]=>
    string(2) "11"
  }
  [2]=>
  array(3) {
    [0]=>
    string(0) ""
    [1]=>
    string(0) ""
    [2]=>
    string(0) ""
  }
}

 
 

Drupal is a registered trademark of Dries Buytaert.