Hey all,
Im trying to make a regular expressions that can handle all the bot commands.
well maybe this is not needed but, how do I do it otherwise?
I got it to grab multiply items from one command.
the code look like this:
<?php
/**
*
*
* @version $Id$
* @copyright 2007
*/
$input = 'loot add <a href="itemref://206204/206204/1">Twilight\'s Murder</a> <a href="itemref://223322/206204/1">I am gimp</a> test';
preg_match_all('/<a href="([^"]*)">([^<]*)<\/a>/im', $input, $matches, PREG_SET_ORDER);
print_r($matches);
?>
and it result in this:
Array
(
[0] => Array
(
[0] => <a href="itemref://206204/206204/1">Twilight's Murder</a>
[1] => itemref://206204/206204/1
[2] => Twilight's Murder
)
[1] => Array
(
[0] => <a href="itemref://223322/206204/1">I am gimp</a>
[1] => itemref://223322/206204/1
[2] => I am gimp
)
)
but I still lack to be able to grab loot add and test
I tryed to put in (\w*) thro it give all kind of diffrent output.
The output im looking for is this:
Array
(
[0] => Array
(
[0] => loot
)
[1] => Array
(
[0] => add
)
[2] => Array
(
[0] => <a href="itemref://206204/206204/1">Twilight's Murder</a>
[1] => itemref://206204/206204/1
[2] => Twilight's Murder
)
[3] => Array
(
[0] => <a href="itemref://223322/206204/1">I am gimp</a>
[1] => itemref://223322/206204/1
[2] => I am gimp
)
[4] => Array
(
[0] => test
)
)
this parser should be working with all count of pre word/numbers and after word/numbers