Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a document where there are many instances of two pieces of information on a single line, like

 assigned to John Doe, estimate 2 days

and I want them to appear on two different lines, like

assigned to: John Doe
estimate: 2 days

but when I tried using wildcards, I didn't go far. My best guess was: find assigned to*, estimate*\preplace with assigned to:*\p estimate:*\p and of course, this did not produce the desired result, but

assigned to:*
estimate:*
How do I specify a wildcard in Find and direct Replace to keep the same content which was found with the wildcard, but changing the content around it?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

You'll have to use Regexp.

Search expression:

assigned to (<*>) (<*>)

Replace expression:

assigned to: \1 \2 ^p

So that takes care of splitting the name. For the estimates:

Search expression

, estimate (<*>) (<*>)

Replace expression

estimate: \1 \2

Test case:

Search for assigned to (<*>) (<*>) and replace with assigned to: \1 \2 ^p

Search for , estimate (<*>) (<*>) and replace with estimate: \1 \2

share|improve this answer
add comment

you can use 2 find and replaces which worked for me, one that was Find Assigned to and replace Assigned To:

the second find , estimate and replace ^13estimate:

^13 will add a CRLF

share|improve this answer
    
The idea occured to me, but I still want to find out if there is a way to do it using the wildcards, because 1. Next time I could have a harder problem to solve where there is no easy two-step-solution and 2. It is improbable, but possible, that assigned to or , estimate appears somewhere else in the document, while the combination of both is more likely to be unique –  rumtscho Nov 8 '10 at 18:16
    
I got it all to work in one for you with the following FIND assigned to, (<*>) (<*>), estimate (<*>) (<*>) AND REPLACE Assigned to: \1 \2 ^13Estimate: \3 \4 --make sure you are using wildcards –  bquaresma Nov 8 '10 at 19:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.