At 17:50 07/05/2007 +1200, Rex Teague wrote:
Greetings from Aotearoa/new Zealand.

Running OOo 2.0.2 on Mepis 6.5 (Ubuntu repositories), been doing the
Linux thing for 1½ years and still learning!

I need to find several hundred instances of a line in an odt document
that have an @ as a common denominator (not an email address) and
reformat them as bold. After spending hours researching regular
expressions in the archives and on the Internet, I haven't found an
answer. Can somebody here give me guidance, I know how to do the bold
bit?

A sample of the line is: "by Howard on Mar 15th, 2007 @ 9:11pm" without
the quotation marks. They all vary, except for the @ and ideally I want
to then delete the @ and what follows it. Could be a second operation?

Cheers... Rex

The detailed answer to this will depend on what you mean by a line. Do these lines start and finish with hard returns? In other words, are the lines actually, in word processor terms, complete paragraphs? Or are they delimited by line breaks - the sort you get by pressing Shift+Enter? Or are they just lines in the sense of what currently happens to surround the "@" sign on a line in a flowing paragraph? (I guess they are not that third possibility.) Or some mixture of these - do they perhaps start or end a paragraph?

If they are actually paragraphs, you should be able to achieve what you ask by putting
     [EMAIL PROTECTED]
in the "Search for" box and
     &
in the "Replace with" box. The ".*" means any number of any character and the "&" replaces the found text with an exact copy. Tick the "Regular expressions" box (select "More Options" if necessary). Put the cursor in the "Replace with" box and use the "Format" button to attach the Bold font attribute. (You say you know this bit.)

If the lines are delimited by line breaks, your search pattern should be
     [EMAIL PROTECTED]
instead. But that won't find a line that happens to start or end a paragraph. Those possibilities are left, as they say in the best textbooks, as an exercise for the reader!

The second problem is easier: replace
     @.*
with nothing. Precede the pattern with a space if the "@" sign is always preceded by a space and you'd like that deleted too.

I don't see an easy way to combine these replacements, but that is hardly a problem.

Incidentally, I take it that when you say "not an email address", you mean that these are not, as it happens, email addresses. If you mean that you want the search pattern to catch everything that has an "@" sign but is *not* an email address, that's another question. If the "@" signs you want to find are always preceded and followed by spaces, you can probably just interpolate spaces in the pattern suggested above.

Brian Barker

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to