improve/fix cpu-hogging regex, tidy up code
catch errors related to bbcode regex caching/execution