i partly solved the problem using this regex: $tutorial['pagetext'] = preg_replace_callback('#\[img\]\s*(\d+)\s*\[/img\]#siU', 'image_code_callback', $content['pagetext']); except instead of using [img]foo[/img] i would like to do just [img=foo] any help? Sebastian wrote: > very new to regex > > i have a string with "bbcode" such as [img=XXX] > (XXX being numeric) > > how do i search the string for the value of the bbcode and compare it to > another variable? > so i can take XXX and compare it to $image dynamically. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php