tags:

views:

97

answers:

2

Basically I am using MS Word's find and replace feature (wildcard:true)

but the text I have to edit contains stuff that messes up the search:

//more text in different format above

<file name="london_bitmap" bits="24", owner="sergio"> 1 2 3 </file>
<file name="paris_bitmap" bits="24", owner="sergio"> 1 2 3 </file>
<file name="moscow_bitmap" bits="24", owner="sergio"> 1 2 3 </file>

I want to replace bitmap with a bmp prefix so:

<file name="bmp_london" bits="24", owner="sergio"> 1 2 3 </file>

When I use something like this:

(<*>)_(<bitmap>)

it captures not 1 line but all it can find till it hits "bitmap"

Any idea on how to solve this? Maybe but getting the word just previous to "bitmap"?

A: 

Not sure if word supports lazy evaluation but you might try replacing * by *?

ennuikiller
Unfortunately appending a question mark won't help: in MS Word with wildcard:true, ? means "match any single character" rather than "make the preceding match non-greedy".
Dan Blanchard
+1  A: 

The following works (in Word 2003) as the search string

([!"]@)_(<bitmap>)

The [!"] part means : match any single character that isn't a double quote character, and the @ qualifier means "find at least one of the preceding". The replacement expression (which I expect you already know :) is

bmp_\1

Hope this helps!

Dan Blanchard