0

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?

2 Answers 2

1

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

1

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

2
  • 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, 2010 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, 2010 at 19:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .