Extend Word selection backwards and forwards to character

Hello,
I have a MS Word document that has numerous color groups like this:

I want to choose one of the colors for each group and delete the rest. So my ideal workflow is to select one of the colors, copy it, select the brace group, and paste over it.

Through Keyboard Maestro, I have the bottom tip of my digital stylus sending the following command:

tell application "System Events"
    key code 123 using option down
    key code 124 using {shift down, option down}
end tell

Which selects the word that I point at, and then I have Keyboard Maestro send a copy command.

The problem I have is how do I get MS Word to extend the selection back to the first { brace, and forward to the } brace? As soon as I figure that out, I can have Keyboard Maestro send a paste command to effectively replace the selected brace group w/ the word (color) that I’ve copied.

Bump for Bbedit / TextWrangler solution. I’d lose some formatting but that’s not a big deal.

Something like this should do what you want:

tell application id "com.barebones.bbedit" -- BBEdit.app
	set selOffset to characterOffset of selection
	set selContents to contents of selection
	set startOffset to characterOffset of character -1 of line 1 of selection whose contents = "{" and characterOffset < selOffset
	set endOffset to characterOffset of character 1 of line 1 of selection whose contents = "}" and characterOffset > selOffset
	select characters startOffset thru endOffset of text document 1
	set contents of selection to selContents
end tell

That worked great. Thanks a bunch for your help.

A possible alternative:

tell application id "com.barebones.bbedit"
	set selContents to contents of selection
	set selOffset to characterOffset of selection
	set startOffset to characterOffset of found object of (find "{" searching in characters 1 thru selOffset of text document 1 options {backwards:true})
	set endOffset to characterOffset of found object of (find "}" searching in characters selOffset thru -1 of text document 1)
	set contents of characters startOffset thru endOffset of text document 1 to selContents
end tell