OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Find & Replace Hidden Characters

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer
View previous topic :: View next topic  
Author Message
Sean
Guest





PostPosted: Fri Apr 16, 2004 10:45 pm    Post subject: Find & Replace Hidden Characters Reply with quote

In MSWord, I've taken for granted doing batch replacement of hidden characters (particularly the hard return, soft return, and tab), but there appears to be no such corresponding option in OO (see Edit > Find & Replace, or Ctrl-F). Tell me this isn't true. Tell me there's something I've missed.
Back to top
Gabor
Super User
Super User


Joined: 21 Sep 2003
Posts: 610
Location: Hungary (E-Europe)

PostPosted: Sat Apr 17, 2004 1:47 am    Post subject: regular expressions Reply with quote

It is not exactly as easy to use as in MS but it exsts.
Open Help
Click Index
Write Regular expressions
It needs time to understand anget accustomed to.
But do not give it up easily even if it looks terrible first.
Back to top
View user's profile Send private message
esperantisto
Super User
Super User


Joined: 26 Dec 2003
Posts: 779
Location: Belarus

PostPosted: Sat Apr 17, 2004 3:16 am    Post subject: Reply with quote

I'd only add, that unfortunately, you cannot replace paragraph breaks with something (well, you'll need some little tricks), whereas you can replace something with paragraph breaks (I find this incosistency somewhat annoying).
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Sat Apr 17, 2004 7:14 am    Post subject: Reply with quote

esperantisto,

I don't have any problem replacing a paragraph break with something if it is the only thing I find, i.e., Find = "$", Replace = "Something", Regular Expressions checked. On the other hand if Find = "something$" and Replace = "somthing else", then only the words will be replaced and the paragraph break will remain.

Do you have a little trick to solve the second example in one operation?
Back to top
View user's profile Send private message
Sean
Newbie
Newbie


Joined: 17 Apr 2004
Posts: 1

PostPosted: Sat Apr 17, 2004 12:16 pm    Post subject: Reply with quote

esperantisto wrote:
I'd only add, that unfortunately, you cannot replace paragraph breaks with something (well, you'll need some little tricks), whereas you can replace something with paragraph breaks (I find this incosistency somewhat annoying).

I'm trying this right now, but it isn't working for me. What am I supposed to use in the Replace field to change the Find instances to paragraph breaks? I tried both '/n' and '^$', but that only inserts those characters, not a paragraph break. And yes, I do have "Regular Expressions" checked.
Back to top
View user's profile Send private message
Guest






PostPosted: Sat Apr 17, 2004 3:38 pm    Post subject: Reply with quote

JohnV wrote:
esperantisto,

I don't have any problem replacing a paragraph break with something if it is the only thing I find, i.e., Find = "$", Replace = "Something", Regular Expressions checked. On the other hand if Find = "something$" and Replace = "somthing else", then only the words will be replaced and the paragraph break will remain.

Do you have a little trick to solve the second example in one operation?


OK, I haven't tried it, not even replacing the "$" character, but ...

What would happen if you replaced just the $ by some recognisable, but unnecessary characters, like #$#$#? Then replace the resulting "something#$#$#" by "something else"?

David.
Back to top
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Sat Apr 17, 2004 5:59 pm    Post subject: Reply with quote

Quote:
What am I supposed to use in the Replace field to change the Find instances to paragraph breaks?

Strangely, you use $ to find paragraph breaks but \n in the Replace box to change whatever you found to a paragraph break. BTW, &\n or \n& will keep what you found and insert a paragraph break.
Quote:
What would happen if you replaced just the $ by some recognisable, but unnecessary characters, like #$#$#? Then replace the resulting "something#$#$#" by "something else"?
That is in fact the way I do it but I was hoping someone had discovered a way to do it in one operation instead of two.
Back to top
View user's profile Send private message
esperantisto
Super User
Super User


Joined: 26 Dec 2003
Posts: 779
Location: Belarus

PostPosted: Mon Apr 19, 2004 11:42 pm    Post subject: Reply with quote

OK, I really quite incorrectly stated about possibility of finding /eplacing paragraph breaks. But anyway, you can't do something like this (in MS Word syntax): find "^t^p", replace with "^tABC^p^p".
Back to top
View user's profile Send private message
erikanderson3
OOo Advocate
OOo Advocate


Joined: 25 Feb 2004
Posts: 332
Location: San Francisco peninsula

PostPosted: Tue Apr 20, 2004 12:30 am    Post subject: Reply with quote

esperantisto wrote:
OK, I really quite incorrectly stated about possibility of finding /eplacing paragraph breaks. But anyway, you can't do something like this (in MS Word syntax): find "^t^p", replace with "^tABC^p^p".

Hi, I just did. Search for: "\t$", Replace with: "\tABC\n" (minus the quotes). Seems to do exactly what it does in Word, though the syntax is a little different. Since the original found paragraph break isn't included in the found string, you only have to include one line break in the replace string to wind up with two paragraphs at the end of the operation.

But then that might be the issue you're pointing out -- it's impossible to search and replace on normal paragraph breaks.

Frankly, this strikes me as bizarre, especially with the incosistencies introduced in the use of \n as both the line break find string, and the paragraph break replace string. Forgive me, but WTF?

Cheers,

Erik
Back to top
View user's profile Send private message
ftack
Moderator
Moderator


Joined: 27 Jan 2003
Posts: 3102
Location: Belgium

PostPosted: Tue Apr 20, 2004 5:08 am    Post subject: Reply with quote

This has been filled as an 'issue'. I filled an issue specifically on the \n issue

http://www.openoffice.org/issues/show_bug.cgi?id=27643

but that has been filled as a duplicate of an issue with a broader scope

http://www.openoffice.org/issues/show_bug.cgi?id=25177

so all we can do now is attract attention for the issue and vote for it.
Back to top
View user's profile Send private message
erikanderson3
OOo Advocate
OOo Advocate


Joined: 25 Feb 2004
Posts: 332
Location: San Francisco peninsula

PostPosted: Tue Apr 20, 2004 5:28 pm    Post subject: Reply with quote

Yay, ftack! I just added my two bits, both voting-wise and comment-wise. Let's hope this makes it into 2.0... Very Happy

Cheers,

Erik
Back to top
View user's profile Send private message
Iannz
OOo Advocate
OOo Advocate


Joined: 14 Feb 2004
Posts: 494
Location: Christchurch, New Zealand

PostPosted: Fri Apr 30, 2004 2:09 pm    Post subject: Reply with quote

I have written a macro, IannzFindReplace, for find and replace that can have up to 9 paragraphs specified in the search criteria. You can also search for manual page breaks. I make no guarantees about the macro but would really appreciate feedback on it. It is available from: http://homepages.paradise.net.nz/hillview/OOo/
_________________
Cheers, Ian

http://wiki.services.openoffice.org/wiki/Extensions_development_basic a wiki about writing OpenOffice.org extensions.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group