How to search and replace on special characters such as white space, <EOL>, <CR>?

Asked by Gil Grodsky

Sometimes text has a mixture of carriage returns and end of line characters. I am used to being able to fix that using find and replace in Word. Similarly, sometimes I want to reduce multiple spaces to a single space or get rid of multiple carriage returns. These all used to be easy. How do I do that in Open Office text files? My most common search and replace scenarios are:
o Change end-of-line character (not carriage return) to a space
o Change multiple spaces and tabs into a single space
o Change a period followed by a space into a period followed by two spaces
o Change two consecutive carriage returns (possibly with white space between) into a single carriage return

Also, is there a reference I can use to construct my own search and replace strings?

Thanks,
Gil

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu openoffice.org Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Mariano Mara (marplatense) said :
#1

Two comments here:

1- Open office has support for regular expressions which will help you with some of your requirements (I think all of them are covered witg regular expressions). You activate them by selecting Regular Expressions in the "More options" combo in the Find & Replace form in OO writer. Writing regular expressions is a matter all by itself and not an easy one if you're not programmer. Read the wikipedia article for an introduction and link for several useful sites: http://en.wikipedia.org/wiki/Regular_expressions
2- You can visit this site: http://homepages.paradise.net.nz/hillview/OOo/ where the author has a lot of macros already programmed that might help you out with your needs.
3- If you want to develop your own function, you need to take a look at OO Macros. I found this site the ultimate word about this subject: http://www.pitonyak.org/oo.php. You can download the 445 pages guide that will teach you how to develop your own macros and extend OO to fit exactly your needs.

Good luck!

Revision history for this message
clayms (clayms) said :
#2

In addition to what Mariano Mara stated above. Enter "regular expressions;list of" in the help index for a list of expressions to use.

Revision history for this message
clayms (clayms) said :
#3

Also take a look at Page 15 (pdf page 29) in the Migrating From MsOffice To OOo located at the following link

http://homepages.paradise.net.nz/hillview/OOo/MigratingFromMsOfficeToOOo_PreDraft.pdf

Can you help with this problem?

Provide an answer of your own, or ask Gil Grodsky for more information if necessary.

To post a message you must log in.