I'm having issues with my regex. My syntax seems to be fine as I tested it in a program called Regex Buddy and it worked great.
String to match
CODE
[action]=addItem,[player]=116, [zone]=5, [item_id]=45653, [item_cost]=35, [addItem]=1,
Regex
CODE
\[action\]\=addItem\,\[player\]\=([0-9]+)\,\s\[zone\]\=([0-9]+)\,\s\[item\_id\]=([0-9]+)\,\s\[item\_cost\]\=([0-9]+)\,\s\[addItem\]\=1\,
Error i'm getting
CODE
Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash
My code
CODE
$l['log_what'] = trim($l['log_what']);
$addItem = preg_replace('\[action\]\=addItem\,\[player\]\=([0-9]+)\,\s\[zone\]\=([0-9]+)\,\s\[item\_id\]=([0-9]+)\,\s\[item\_cost\]\=([0-9]+)\,\s\[addItem\]\=1\,', '$1|$2|$3|$4', $l['log_what']);
$addItem = explode('|', $addItem);
$addItem = preg_replace('\[action\]\=addItem\,\[player\]\=([0-9]+)\,\s\[zone\]\=([0-9]+)\,\s\[item\_id\]=([0-9]+)\,\s\[item\_cost\]\=([0-9]+)\,\s\[addItem\]\=1\,', '$1|$2|$3|$4', $l['log_what']);
$addItem = explode('|', $addItem);
Any help is greatly appreciated,
Lang