Hi all,
This code works, but I have a feeling I have done it a long winded/problematic way since my knowledge of regex isn't what it could be, anyone able to comment?
What I am trying to do is obtain the 3 items seperated by '-' inbetween the 2 local tags from the string which could possible have varying amounts of text around it.
Thanks in advance
Stelf
$strtemp = "random text [local]1-200-1[/local] more text";
if (eregi("\[local\]", $strtemp)) {
$result = preg_split('(\[local\]|\[/local\])', substr(stristr($strtemp, '[local]'), 6), -1);
$result = explode("-", $result[0]);
print_r($result);
}
Results which is correct:-
Array
(
[0] => 1
[1] => 200
[2] => 1
)