param0_test1_param1_affiliatewire_%nameID%_test2_param2_param3
%nameID%
param0_test1_param1_affiliatewire_name1_test2_param2_param3
param0_test1_param1_affiliatewire_name_test2_param2_param3
param0_test1_param1_affiliatewire_trollolo_test2_param2_param3
affiliatewire_(.*?)_
<?php
$re = "/affiliatewire_(.*?)_/";
$str = "param0_test1_param1_affiliatewire_name1_test2_param2_param3
param0_test1_param1_affiliatewire_name_test2_param2_param3
param0_test1_param1_affiliatewire_trollolo_test2_param2_param3";
preg_match_all($re, $str, $matches);
print_r($matches);
?>
Array
(
[0] => Array
(
[0] => affiliatewire_name1_
[1] => affiliatewire_name_
[2] => affiliatewire_trollolo_
)
[1] => Array
(
[0] => name1
[1] => name
[2] => trollolo
)
)
<?php
$re = "/(?<=affiliatewire_)[^_\r\n]++/";
$str = "param0_test1_param1_affiliatewire_name1_test2_param2_param3
param0_test1_param1_affiliatewire_name_test2_param2_param3
param0_test1_param1_affiliatewire_trollolo_test2_param2_param3";
preg_match_all($re, $str, $matches);
print_r($matches);
?>
Array
(
[0] => Array
(
[0] => name1
[1] => name
[2] => trollolo
)
)