What version of InDesign?
Sure, it's possible with scripting; but with a (moderately) modern version of InDesign, you can use a GREP style to mark the phone number, and text variables (see First and Last Word on Page) to set your headers.
Sorry, should have specified that. CS4. I'm not very good with GREP, but I did remember that there's a pre-installed GREP search to convert phone numbers with hyphens to a dot format, and I just took out the "replace" code and specified my character style, and that did the trick. I'll check out your link to do the headers. Thanks for a quick reply.
Thanks for the link to the Text Variables instructions. I was a little concerned because when a word was selected, the character style palette didn't indicate that the nested character style was applied, even though it clearly was, so I thought the Text Variables might not pick up the nested style, but it worked like a charm, and all my page headers are populated with the appropriate names.
Yes, that was exactly the right thing to do -- twice
I thought of something to try in combination, but it seems picking up data from GREP styles is not totally reliable to re-use in text variables. Fortunately, the nested style works perfect.[*]
[*] Which is kind of ironic, because nested styles are internally just a variant of (and possibly a first attempt at) GREP styles.