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

How to search for text and make it bold

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


Joined: 12 Jul 2007
Posts: 9

PostPosted: Thu Jul 12, 2007 1:45 pm    Post subject: How to search for text and make it bold Reply with quote

I have some text I want to search for in Writer. It's of the form "Item: 21-9999-99". The 9's will always change, so my regular expression in the search box was this:

Item: 21-[:digit:]*[:digit:]*[:digit:]*[:digit:]*-[:digit:]*[:digit:]*

The replace box is empty with the format set to Bold. However when the searches replace the text, instead of bolding my text it just deletes it! (The empty space is bold, however)

(Question 1): Can the OpenOffice Find and Replace dialog keep the text it found and just add the attribute?

(Q1.5): Can I replace but not skip to the next found item? I need to check that the replacement worked as expected before continuing.

(Q2): Are there any backreferences that work in the "replace" box when searching for RegExes?

I'd settle for finding the text and using a named style, but (Q3): I can't find a way to assign the style in the Replace box. (I don't need to replace all of one style with another, I need to conditionally change to the style).

Last, (Q4): Can I search for page breaks? View Paragraphs can't show them either.

Word does not have these issues. I spend 5% of my working day finding arbitrary text and assigning attributes to them, but can I do this in OO?

Unfortunately OO seems fixated on Regular Expressions, which look at text only one line (paragraph) at a time. However real-world editing is much more likely to require spanning several lines and change text attributes based on various conditions.

Lots of questions in this thread, I guess. Smile

Thanks

[EDIT: I guess I should add that I'm using NeoOffice on a Mac, but the search issues don't seem to change]
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3407
Location: Manchester UK

PostPosted: Thu Jul 12, 2007 2:30 pm    Post subject: Re: How to search for text and make it bold Reply with quote

dzurn wrote:

(Question 1): Can the OpenOffice Find and Replace dialog keep the text it found and just add the attribute?

Put & in the Replace box

dzurn wrote:

(Q2): Are there any backreferences that work in the "replace" box when searching for RegExes?

I don't think so. You can however use Python with OpenOffice when you can replace with backreferences.

dzurn wrote:

Unfortunately OO seems fixated on Regular Expressions, which look at text only one line (paragraph) at a time. However real-world editing is much more likely to require spanning several lines and change text attributes based on various conditions.

I guess one needs to decide what one expects of a text editor and what one expects of a word-processor.
Back to top
View user's profile Send private message
dzurn
General User
General User


Joined: 12 Jul 2007
Posts: 9

PostPosted: Thu Jul 12, 2007 3:35 pm    Post subject: Reply with quote

Thanks for the "&" hint. That did the trick!

Darryl
Back to top
View user's profile Send private message
acknak
Moderator
Moderator


Joined: 13 Aug 2004
Posts: 4295
Location: ~ 40°N,75°W

PostPosted: Thu Jul 12, 2007 5:21 pm    Post subject: Reply with quote

Quote:
(Q1.5): Can I replace but not skip to the next found item? I need to check that the replacement worked as expected before continuing.

Sure. Just click Find (moves to the next match and highlights it), then Replace (does the replacement and moves on to the next match and highlights it). Just keep clicking Replace to process each match in turn. Click Find to move on without doing the replacement.

Quote:
(Q3): I can't find a way to assign the style in the Replace box.

Really? I usually just click Find All (selects all the matches), then use the Writer toolbar or the Stylist to apply a style to the selected text. OOo's Find & Replace dialog gains a lot of flexibility by being "non-modal". You don't have to do everything from within the dialog.

Quote:
(Q4): Can I search for page breaks? View Paragraphs can't show them either.

No, and correct.

Page breaks are shown by a nearly-invisible line at the top margin of the page started by the break. You can change the color of the line to something more visible but it doesn't help much. A really poor design but waay down on the priority list.

Quote:
Unfortunately OO seems fixated on Regular Expressions, which look at text only one line (paragraph) at a time. However real-world editing is much more likely to require spanning several lines and change text attributes based on various conditions.

OOo's regular expressions are poor in several respects, but I've found very little that I needed to do and couldn't. I really don't find too many tasks that need to span paragraphs (lines are not a problem), except when cleaning up plain text to be imported into Writer. In that case, I just use a "real" text editor to do the cleanup.
Back to top
View user's profile Send private message
dzurn
General User
General User


Joined: 12 Jul 2007
Posts: 9

PostPosted: Thu Jul 12, 2007 6:09 pm    Post subject: Reply with quote

acknak wrote:
Quote:
(Q1.5): Can I replace but not skip to the next found item? I need to check that the replacement worked as expected before continuing.

Sure. Just click Find (moves to the next match and highlights it), then Replace (does the replacement and moves on to the next match and highlights it). Just keep clicking Replace to process each match in turn. Click Find to move on without doing the replacement.

What I wanted was to be able to do a "replace" but keep the selection where it is. Word doesn't do that either, to be fair, but I was working on a document with one change per page that I wanted to see before moving on. Not a big deal.

Quote:

Quote:
(Q3): I can't find a way to assign the style in the Replace box.

Really? I usually just click Find All (selects all the matches), then use the Writer toolbar or the Stylist to apply a style to the selected text. OOo's Find & Replace dialog gains a lot of flexibility by being "non-modal". You don't have to do everything from within the dialog.

That's good to know. I haven't tried the "Find All" button, I'll give it a whirl.
Quote:

Quote:
(Q4): Can I search for page breaks? View Paragraphs can't show them either.

No, and correct.

Page breaks are shown by a nearly-invisible line at the top margin of the page started by the break. You can change the color of the line to something more visible but it doesn't help much. A really poor design but waay down on the priority list.

Thanks for the info, I'm glad I'm not just missing some obvious setting or technique.

Quote:

Quote:
Unfortunately OO seems fixated on Regular Expressions, which look at text only one line (paragraph) at a time. However real-world editing is much more likely to require spanning several lines and change text attributes based on various conditions.


OOo's regular expressions are poor in several respects, but I've found very little that I needed to do and couldn't. I really don't find too many tasks that need to span paragraphs (lines are not a problem), except when cleaning up plain text to be imported into Writer. In that case, I just use a "real" text editor to do the cleanup.


Agreed. I just have to get more used to how OO uses RegEx'es ("Find \n and replace with \n"? Eh?). It'd be Real Nice to have access to backreferences in the replacement box, though.

With these answers I was able to get through the day's challenge pretty well. I'm sure I'll start to use them a lot more.

Darryl
Back to top
View user's profile Send private message
acknak
Moderator
Moderator


Joined: 13 Aug 2004
Posts: 4295
Location: ~ 40°N,75°W

PostPosted: Thu Jul 12, 2007 6:42 pm    Post subject: Reply with quote

Quote:
I was working on a document with one change per page that I wanted to see before moving on.

Oh, duh. I missed that completely and I've wanted that many times myself. No decent way that I've found. It would be nice to have both a "Replace" and a "Replace and Find" button.
Back to top
View user's profile Send private message
BillP
Super User
Super User


Joined: 07 Jan 2006
Posts: 2703

PostPosted: Thu Jul 12, 2007 6:51 pm    Post subject: Reply with quote

dzurn wrote:
It'd be Real Nice to have access to backreferences in the replacement box, though.l

This issue was submitted 4 years ago. You can register and vote for it here:
http://qa.openoffice.org/issues/show_bug.cgi?id=15666
Back to top
View user's profile Send private message
AndrewZ
Moderator
Moderator


Joined: 21 Jun 2004
Posts: 4140
Location: Colorado, USA

PostPosted: Tue Jan 01, 2008 8:53 am    Post subject: Reply with quote

BillP wrote:
dzurn wrote:
It'd be Real Nice� to have access to backreferences in the replacement box, though.l

This issue was submitted 4 years ago. You can register and vote for it here:
http://qa.openoffice.org/issues/show_bug.cgi?id=15666


No need anymore. Oh, happy day. With 101 votes (as of today), the backreferences feature is implemented, tested, and working.

Until OOo 2.4 is released in March 2008, you can download a preview here
http://openofficeorgfoo.blogspot.com/2007/12/backreferences-in-replacements-new.html
_________________
<signature>
* Did you solve your problem? Do others a favor: Post the solution
* OpenOffice.org Ninja
* BleachBit
</signature>
Back to top
View user's profile Send private message Visit poster's website
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