This can't be done with an expression alone. You have to use a script to measure and mark the dimensions of the layer, using the AVLayer sourceRectAtTime() function (the scripting docs has the exact syntax). My preferred method to mark the layer is to add a point control to the text layer for the upper left and lower right corners. Then you can either scale the solid using the script, or use an expression to do it.
sourceRectAtTime() does not work in expressions, only in scripts. For versions CS6 and below there is no property of text with that name that can be accessed through expressions. Look at nab's expression here http://www.aenhancers.com/viewtopic.php?f=6&t=931
Though if you want a workaround then You need to control the x scale of your elements via a slide controller. Make one NULL object as "Width Controller" and on it add Effects>Expression Controls>Slide Controller. Take the x scale of your element (e.g. a rectangle shape behind your text) and pickwhip it to that Slide Controller.