find ^p^? but not ^p^p

I have a doc (Form.csv) I start in excel, copy and paste some data, close excel and open Form.csv in word. I run my macro and when it finishes I have my data in lines separated by ^p^p.
A few instances in my macro the find and replace doesn't work properly, so I am left with some lines of data that have ^p left in.
After the macro has finished I do a find: ^p^? which is all well and good, but means I have to search every line. I want to find ^p^? but not ^p^p
Jimeo WilliamsRetiredAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


maybe you should first replace
^p^p^p and then ^p^p to eliminate uneven and even numbers of paragraphs

Jimeo WilliamsRetiredAuthor Commented:
There are no ^p^p^p
Only ^p^p
and some paragraphs with ^p    this is the one I need to find and do a fix around it
Jimeo WilliamsRetiredAuthor Commented:
I want to find ^p^? but not ^p^p
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Rgonzo made a good suggestion that I'll illustrate slightly differently.

First, replace ^p^p with some string that you know you won't have anywhere else, such as ^^^^PPPP.  Then you can search for ^p^ and do what you want.  After that, replace ^^^^PPPP (or whatever you used in the first replacement) with ^p^p.

Of course, this won't work if you have ^p^p^p^, but I'm not sure how you would want that treated.
Do you have a text editor, such as Notepad++, that will show you the text and non-text characters?  I'm curious about what is in the original CSV and what Excel does to the CSV content when it saves it.  I've seen cases where systems, such as UNIX/Linux, use Cr to delimit lines and Windows systems use/expect CrLf delimited lines.
It may be more effective to look at the actual problem: "A few instances in my macro the find and replace doesn't work properly, so I am left with some lines of data that have ^p left in."  What is your find-and-replace macro trying to do and why is it not working properly?
Jimeo WilliamsRetiredAuthor Commented:
During the macro it can find the paragraph mark ^p but not replace it in some instances. Thanks for your help.
Jimeo WilliamsRetiredAuthor Commented:
When I take out the double paragrah marks ^p^p and replace them with /// the document comes to a standstill. It's quicker to search through every paragraph mark.
When I put ^p^? in Find,  I can find all instances of double paragraphs and my errors, I just want to find the errors
Something like   ^p[!^p]^?   but that doesn't find anything
Please post a Word document, containing actual or representative text, where your replace command(s) fail.

I'm beginning to suspect that there might be some sequences where it looks like ^p^p, but is actually ^p_^p.  In this case, the _ represents some non-visible character.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jimeo WilliamsRetiredAuthor Commented:
Thanks aikimark, I think I've fixed it.
I replaced all paragraph marks with a unique symbol at the start and replaced them at the finish of the macro.
So far, so good.
I didn't know about non-visible characters
"During the macro it can find the paragraph mark ^p but not replace it in some instances."  I would focus on this and not try to clean it up afterwards.  Why doesn't it replace it in some instances?
Jimeo WilliamsRetiredAuthor Commented:
Sometimes the paragraph mark has a non-visible character next to it for some reason.
Changing ^p to another identifier at the start of the macro and inserting the ^p at the end seems to have fixed the problem.
Thanks for the help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.