| View previous topic :: View next topic |
| Author |
Message |
Sean Guest
|
Posted: Fri Apr 16, 2004 10:45 pm Post subject: Find & Replace Hidden Characters |
|
|
| 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

Joined: 21 Sep 2003 Posts: 610 Location: Hungary (E-Europe)
|
Posted: Sat Apr 17, 2004 1:47 am Post subject: regular expressions |
|
|
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 |
|
 |
esperantisto Super User

Joined: 26 Dec 2003 Posts: 772 Location: Belarus
|
Posted: Sat Apr 17, 2004 3:16 am Post subject: |
|
|
| 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 |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8995 Location: Lexinton, Kentucky, USA
|
Posted: Sat Apr 17, 2004 7:14 am Post subject: |
|
|
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 |
|
 |
Sean Newbie

Joined: 17 Apr 2004 Posts: 1
|
Posted: Sat Apr 17, 2004 12:16 pm Post subject: |
|
|
| 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 |
|
 |
Guest
|
Posted: Sat Apr 17, 2004 3:38 pm Post subject: |
|
|
| 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

Joined: 07 Mar 2003 Posts: 8995 Location: Lexinton, Kentucky, USA
|
Posted: Sat Apr 17, 2004 5:59 pm Post subject: |
|
|
| 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 |
|
 |
esperantisto Super User

Joined: 26 Dec 2003 Posts: 772 Location: Belarus
|
Posted: Mon Apr 19, 2004 11:42 pm Post subject: |
|
|
| 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 |
|
 |
erikanderson3 OOo Advocate

Joined: 25 Feb 2004 Posts: 332 Location: San Francisco peninsula
|
Posted: Tue Apr 20, 2004 12:30 am Post subject: |
|
|
| 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 |
|
 |
ftack Moderator


Joined: 27 Jan 2003 Posts: 3102 Location: Belgium
|
|
| Back to top |
|
 |
erikanderson3 OOo Advocate

Joined: 25 Feb 2004 Posts: 332 Location: San Francisco peninsula
|
Posted: Tue Apr 20, 2004 5:28 pm Post subject: |
|
|
Yay, ftack! I just added my two bits, both voting-wise and comment-wise. Let's hope this makes it into 2.0...
Cheers,
Erik |
|
| Back to top |
|
 |
Iannz OOo Advocate

Joined: 14 Feb 2004 Posts: 494 Location: Christchurch, New Zealand
|
|
| Back to top |
|
 |
|