Quantcast
Channel: How can I insert the original matched pattern (OLD STRING) into the result (NEW STRING) Using Microsoft Word's Find/Replace Feature? - Super User
Viewing all articles
Browse latest Browse all 3

How can I insert the original matched pattern (OLD STRING) into the result (NEW STRING) Using Microsoft Word's Find/Replace Feature?

$
0
0

Microsoft Word's find/replace feature seems like it is many-to-one.

Suppose that we have a word document numbers surrounded by parentheses, such as (6)
and we want to remove the parentheses and place a dot at the end, such as 6.

Suppose we open up find/replace. We then enter in the following options:

FIND WHAT:     (^#)
REPLACE WITH:  5. 

The above will have the following effect:

.--------.-------.
| BEFORE | AFTER |
.--------.-------.
| (1)    | 5.    |
.--------.-------.
| (2)    | 5.    |
.--------.-------.
| (3)    | 5.    |
.--------.-------.
| (4)    | 5.    |
.--------.-------.

How can we insert the matched pattern in the output/result?

I want to do something like this:

##             (5)
##             becomes
##             AAAA(5).1234

FIND WHAT:     (^#)
REPLACE WITH:  AAAA^MATCHED_PATTERN.1234

##             AAAA(5).1234
##             becomes  
##             5).1234

FIND WHAT:     AAAA(
REPLACE WITH:   

##             5).1234
##             becomes
##             5.

FIND WHAT:     ).1234
REPLACE WITH:   

Viewing all articles
Browse latest Browse all 3

Trending Articles