hi,
i have solved it myself, in only 3 lines of code!
original string something like:
$string = 'blah blah .. [image]001[/image] ..';
$patern1 = '[image][0-9]{1,}';
$patern2 = '[\/image]';
$search_for_id = ereg($patern1, $string, $arr_id);
// arr_id[0] will carry the matched string i.e. [image]001
// this will chop off the first 7 characters i.e. [image]
$the_id = strsub($arr[0], 7);
so now $the_id = 001
thats it! you can now use the $the_id to do whatever you want.
and after this you can replace the whole [image]001 with the generated code, e.g:
$new_code = ereg_replace($patern1, $generated_code, $string);
I hope this is useful for you too Jim.
regards,
Daarius ...