|
If this is a mission-critical script, one piece of advice: don't do it yourself. Stuff like this, when done wrong, is exactly what causes huge server load, infinite loops, dead pages, etc. It seems to me that you aren't very experienced in PHP yet, so if you aren't just doing this as some exercise but as something essential to one of your sites, getting a real programmer is probably a good idea.
__________________
/(bb|[^b]{2})/
|