ok so after some time i can do some simple reg exp but this one is confusing me. I currently am testing my reg exp on regexpal.com but php wants to work differently
this is what im using
preg_match_all('/{(\w+)(([:]\w+)*)}/', $page_content, $matches, PREG_SET_ORDER);
foreach($matches as $match) {
$src = $match[1];
echo ($match[0])?$match[0]."/":'';
echo ($match[1])?$match[1]."/":'';
echo ($match[2])?$match[2]."/":'';
echo ($match[3])?$match[3]."/":'';
echo ($match[4])?$match[4]."/":'';
echo '<br />';
}
i am trying to match
{asda:asdasad:asdasd:asd3ea:666}
but im getting
/asda/:asdasad:asdasd:asd3ea:666/:666/
need to get
asda/:asdasad/:asdasd/:asd3ea/:666
i need to be to put these items into an array which i can do only if i can get the items by themselves.
this is what i have tried
{(\w+)([:]\w+)?}
{(\w+)(([:]\w+)+)?}
{(\w+)([:]\w+)+}
{(\w+)([:]\w+)([:]\w+)([:]\w+)([:]\w+)}
the last one works only if i have the 5 different items. but not all the items are going to have 5 items. they range from the first item up to the 5th.
i just dont understand why this works on the example of the website but in php it hates me.
thanks in advance