View previous topic :: View next topic |
Author |
Message |
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Mon Dec 27, 2010 5:17 pm Post subject: Find & Replace underscores with italic? |
|
I've received a long, long plaintext which (for reasons to do with unreason) the author has marked up with _underscore characters_ when the text between them should be in italics.
I've managed to replace the opening character with a ± and the closing one with a § (that was some fun)'
Is there a way to get the F&R to replace instances of these pairs of characters with italic/end-of-italic? |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Mon Dec 27, 2010 6:31 pm Post subject: |
|
Now that you have replaced beginning "_" characters with "±" and ending "_" characters with "§", you should be able to do this using the following steps. The tricky part for me was figuring out what to put in the "Search for" field so that multiple occurrences of these characters in a single paragraph are handled properly.
1. Position the cursor at the very beginning of your document and open the Find and Replace dialog.
2. Put the following in the "Search for" field:
3. Put the following in the "Replace with" field:
4. Press the "More Options button and check the "Regular expressions" checkbox.
5. Put the cursor in the "Replace with" field and press the "Format" button. In the dialog that appears, click on the "Font" tab, select "Italic" from the "Typeface" column, and press the "OK" button.
6. Make sure that the "Search backwards" checkbox is unchecked and then press the "Replace" button. If you are confident that the "Replace" button is doing what you want, then you can press the "Replace All" button.
Does that work for you?
Patrick |
|
Back to top |
|
|
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Tue Dec 28, 2010 2:00 am Post subject: |
|
Hi, thanks, I'd already got a response from floris_v over at the OOo forum, which led me to the following similar solution:
• perform a Find All on ±[^§]*
• close the Find & Replace box
• cmd-I to make all selected text italics
• use Find & Replace to delete all ± & §
...but I just tried yours too (for educational purposes) and it works fine, with less steps.
Many thanks, I'll post your solution over there . |
|
Back to top |
|
|
sardisson Town Crier
Joined: Feb 01, 2004 Posts: 4588
|
Posted: Tue Dec 28, 2010 3:35 pm Post subject: |
|
We should add this to the Using Find and Replace page on the wiki.
I missed the replies somehow and just worked this out myself based on the info in the wiki and a tiny bit of the Help file (ending up with Patrick's steps, which I think are saner/safer than the other ones yoxi got from OOo), but setting up a concrete example in the wiki would be much more useful for future users than having to piece it together themselves
Note: for the unmodified _original file_, you'd want to use in the "Search for:" field.
Smokey _________________ "[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki |
|
Back to top |
|
|
yoxi Cipher
Joined: Sep 07, 2004 Posts: 1799 Location: Dawlish, Devon
|
Posted: Tue Dec 28, 2010 4:09 pm Post subject: |
|
That's just sexy - thanks. This is likely to happen again, so it's good not to have to do the extra layer of conversion. By the way, I ended up using Patrick's instead anyway! |
|
Back to top |
|
|
sardisson Town Crier
Joined: Feb 01, 2004 Posts: 4588
|
|
Back to top |
|
|
|