Closed solstag closed 9 years ago
Previous regex would cause matches to span several tags, particularly when mixing regular and forum mentions, thus never recognizing those mentions and not delivering to the forums.
Here's an example of what the old regexp would do:
php > $body = '@![zrl=https://mobiliza.all4.cc/channel/testeforum]TesteForum+[/zrl] papa @![zrl=https://mobiliza.all4.cc/channel/oda]Oda[/zrl] @![zrl=https://mobiliza.all4.cc/channel/testeforum]TesteForum+[/zrl] mama @![zrl=https://mobiliza.all4.cc/channel/oda]Oda[/zrl] @![zrl=https://mobiliza.all4.cc/channel/testeforum]TesteForum+[/zrl] @![zrl=https://mobiliza.all4.cc/channel/testeforum]TesteForum+[/zrl]'; php > php > $pattern = '/@\!?\[zrl\=(.*?)\](.*?)\+\[\/zrl\]/'; php > php > preg_match_all($pattern,$body,$matches,PREG_SET_ORDER); php > php > var_export($matches); array ( 0 => array ( 0 => '@![zrl=https://mobiliza.all4.cc/channel/testeforum]TesteForum+[/zrl]', 1 => 'https://mobiliza.all4.cc/channel/testeforum', 2 => 'TesteForum', ), 1 => array ( 0 => '@![zrl=https://mobiliza.all4.cc/channel/oda]Oda[/zrl] @![zrl=https://mobiliza.all4.cc/channel/testeforum]TesteForum+[/zrl]', 1 => 'https://mobiliza.all4.cc/channel/oda', 2 => 'Oda[/zrl] @![zrl=https://mobiliza.all4.cc/channel/testeforum]TesteForum', ), 2 => array ( 0 => '@![zrl=https://mobiliza.all4.cc/channel/oda]Oda[/zrl] @![zrl=https://mobiliza.all4.cc/channel/testeforum]TesteForum+[/zrl]', 1 => 'https://mobiliza.all4.cc/channel/oda', 2 => 'Oda[/zrl] @![zrl=https://mobiliza.all4.cc/channel/testeforum]TesteForum', ), 3 => array ( 0 => '@![zrl=https://mobiliza.all4.cc/channel/testeforum]TesteForum+[/zrl]', 1 => 'https://mobiliza.all4.cc/channel/testeforum', 2 => 'TesteForum', ), ) php >
Previous regex would cause matches to span several tags, particularly when mixing regular and forum mentions, thus never recognizing those mentions and not delivering to the forums.
Here's an example of what the old regexp would do: