# [SOLVED] Find and Replace using Wildcards



## JTOMKO (Oct 12, 2011)

HI all - I have a very ugly file that I'm trying to turn into a usable format. There were over 3,000 "records" that had up to 7 lines per record that came in a plain text file. What I'd like to do is consolodate those 7 lines into one record. So I did a find and replace to remove all line breaks. Each "new" record will start with an SSN. So what I'd like to do now is another find and replace that will find an SSN and replace it with a carriage return and keep the SSN intact, essentially inserting a carriage return before each SSN.

So far, the "find" works just fine. I have the 'use wildcards' box checked and "<[0-9]{3}-[0-9]{2}-[0-9]{4}>" (minus the quotes) in the find what field. It does find every SSN just fine.

Now the problem is in the 'replace' field. I read through a number of web pages that all had similar suggestions of "^p" for the page break and \1 \2 to preserve the SSN characters and order of numbers. I've tried ^13, ^v, etc. Every time I get this message that reads "The Replace With text contains a group number which is out of range."

Any help whatsoever would be greatly apprciated. Thank you!


----------



## AlbertMC2 (Jul 15, 2010)

*Re: Find and Replace using Wildcards*

Hi

Try:
Find: *(<[0-9]{3}-[0-9]{2}-[0-9]{4}>)*
Replace with: *\1^13*


----------



## macropod (Apr 11, 2008)

*Re: Find and Replace using Wildcards*

Alternatively, since you say you want the CR _before _the SSN:
Find = <[0-9]{3}-[0-9]{2}-[0-9]{4}>
Replace = ^p^&


----------



## JTOMKO (Oct 12, 2011)

*Re: Find and Replace using Wildcards*

Thank you, macropod. Your solution worked.

And thank you to AlbertMC2, however your solution did not work.


----------

