Forum Moderators: coopster
This is the code for the first problem:
<?php
$string="<@abc@> asd <@ff@> <@aaa@>";$pattern='/(abc)/';
preg_match_all($pattern,$string,$result);
echo $result[0][0];
?>
This is the code for the second problem:
<?php
$string="<@abc@> asd <@ff@> <@aaa@>";$pattern='/<(.*?)>/';
preg_match_all($pattern,$string,$result);
echo $result[0][0];
?>
You have to adjust pattern for the first code, this way it just retrieves 'abc'.