extract email addresses, Powerfind not working

Have a problem? A question? This is the place for answers from other Express users.
Post Reply
derekroff
Posts: 7
Joined: 2006-12-12 09:39:15

extract email addresses, Powerfind not working

Post by derekroff »

PowerFind is not working for me, as described in the Nisus Writer Express Help. I am using Nisus 2.7, OS 10.4.8, on a G5 tower. I cannot duplicate the results of many of the PowerFind examples. In particular, all the examples using parentheses don't work for me. When I do any search, I get the message "Found no occurrences." I also notice that when I enter a search in PowerFind, switch to Nisus Help in the Help Viewer, and then switch back to Nisus Express, my search string is corrupted.

I'd like to understand these problems, but I'd also like to solve my real task. I get lists of email addresses in the common format:

Peggy Worth <peggyues@yahoo.com>
Rose Davis <rsgtrrrz@netzero.com>
Martin Miller <martinmuelisto@gmail.com>
Robert Quill <timedplumo@yahoo.com>
Spencer L. Smith <spencerforgisto@gmail.com>
Dave English <daveangla@hotmail.com>
Robin Antau <robinarobin@yahoo.co.uk>

I want to be able to copy and paste to another file only the email addresses, without the real names nor the angle brackets. I have to do this once or more per day, so I want to create a streamlined procedure.

<anyCharacter1+> does almost what I want. If finds the email address with the angle brackets. I could copy and paste this data, and then delete the angle brackets from the new file, with additional find/replace steps. Still, it seems like it ought to be possible to do this in one operation.

If PowerFind's parentheses were working for me, I think I could do it. Can anyone help me understand my general PowerFind problem and the solution to this specific task?

Thanks,

Derek Roff
Derek Roff
Language Learning Center
University of New Mexico
derek@unm.edu
User avatar
xiamenese
Posts: 543
Joined: 2006-12-08 00:46:44
Location: London or Exeter, UK

Re: extract email addresses, Powerfind not working

Post by xiamenese »

derekroff wrote:PowerFind is not working for me, as described in the Nisus Writer Express Help. I am using Nisus 2.7, OS 10.4.8, on a G5 tower. I cannot duplicate the results of many of the PowerFind examples. In particular, all the examples using parentheses don't work for me. When I do any search, I get the message "Found no occurrences." I also notice that when I enter a search in PowerFind, switch to Nisus Help in the Help Viewer, and then switch back to Nisus Express, my search string is corrupted.
I haven't tried this, but in general, I have found them to work. I too have had "found no occurrences" messages when I have known there to be occurrences in the text ... I discovered that these were due to having "whole word" switched on when it was not appropriate.
I'd like to understand these problems, but I'd also like to solve my real task. I get lists of email addresses in the common format:

<snip>*

I want to be able to copy and paste to another file only the email addresses, without the real names nor the angle brackets. I have to do this once or more per day, so I want to create a streamlined procedure.

<anyCharacter1+> does almost what I want. If finds the email address with the angle brackets. I could copy and paste this data, and then delete the angle brackets from the new file, with additional find/replace steps. Still, it seems like it ought to be possible to do this in one operation.
I suspect the problem is not in the parentheses but in the angle brackets. Bearing in mind that I'm anything but an expert on GREP or its NWE equivalent, I've had a look at this and been through the help files. I tried
(<)(.+)(>) and (\<)(.+)(\>) but both of them find the string including the angle brackets. So I had a look through the Help files which included the following lines ...
Expression: Finds:

\(([^(]|\n)+\) Any text between parentheses:<[""].:+:>[""] Any text between quotes

^\<:a:+\> Any alphabetic word at the beginning of a paragraph
which suggests that < and > have the meta-functions of "opening" and "closing" and \< and \> have the meta-functions of "beginning of paragraph" and "end of paragraph" respectively, though this is not documented in the Help system.

I just wonder, therefore, if the solution might not be a string of the kind that I used but using the hexadecimal representation for < and >. Again, what it is I don't know and I'm trying hard not to be the inveterate procrastinator that I basically am, so, with apologies, I'm going to leave it to you or any respondents to find out what they are.

HTH
Mark

SUBSEQUENT EDIT

On a further try, using (<)(.+)(>) in the Find box and then \2 in the Replace box did in fact remove the angle brackets, so the parentheses are working on my system. But I admit to not being able to work out how to adapt the "Any text between quotes" or "Any text between parentheses" to find just the strings between the angle brackets.

THIRD EDIT

* addresses edited out following Martin's suggestion.
Last edited by xiamenese on 2007-02-13 00:52:47, edited 1 time in total.
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: extract email addresses, Powerfind not working

Post by martin »

Hello Derek, before getting to your problem I might suggest you remove the email addresses you've posted. A spammer could harvest them for unsavory purposes.
derekroff wrote:I want to be able to copy and paste to another file only the email addresses, without the real names nor the angle brackets. I have to do this once or more per day, so I want to create a streamlined procedure.
This macro should do what you want.

As for accomplishing the search with a single PowerFind Pro expression: you would use lookahead and lookbehind. These are special expressions that require the presence of text without actually including that text in the match.

Unfortunately our search engine does not support lookbehind, only lookahead. If we did support lookbehind this is the PowerFind Pro expression you might use:

Code: Select all

(?<=<).+(?=>)
Last edited by martin on 2007-02-13 17:13:49, edited 1 time in total.
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Post by martin »

Oh, I almost forgot: the reason the parenthesis are not working as you expect might be due to the differences between PowerFind and PowerFind Pro.

PowerFind treats any "(" or ")" character you enter as a literal- it actually tries to find that character in your document. If you want to "capture" using PowerFind please use the menu Find What > Match > Found. We realize this is a poorly named menu and will have it corrected for Nisus Writer Pro.

PowerFind Pro however considers parentheses "capture" especials and makes the contents of the capture available as a back reference ("\1" etc).
derekroff
Posts: 7
Joined: 2006-12-12 09:39:15

extract email addresses, Powerfind not working

Post by derekroff »

Thanks for your help and suggestions. All of the email addresses that I listed before are fake- ficititious inventions for the purpose of the email. Sorry, I should have said that.

I tried Martin's macro, and I get the following error message:

Perl Error
Perl reported an error trying to run 'Extract email addresses (Derek)':

Unrecognized character \xC2 at /Users/derek/Library/Application Support/Nisus Writer/Macros/Extract email addresses (Derek).pl line 12.

I'm still unclear on my problems with PowerFind. I was unable to run several of the examples from the PowerFind section of the Nisus Help document. These included items that did not contain angle brackets. I tried typing in the parentheses, as shown and stated in the PowerFind (_not_ PowerFind Pro) section of the Help Document. I also tried inserting the parentheses from the Find>Special Characters menu. Neither approach worked.

I am guessing that there is something wrong with my technique, or something weird about my system. However, perhaps the Help Document contains errors. If someone wants to try the Date reordering/reformatting PowerFind command string, that is one that didn't work for me at all. In every variation that I tried, Find said "No occurrences found."

Derek
Derek Roff
Language Learning Center
University of New Mexico
derek@unm.edu
cchapin
Posts: 424
Joined: 2004-02-25 18:28:40
Location: Nagoya, Japan

Post by cchapin »

Here's a screenshot of a Find-Replace dialog that worked for me.

Image

This is PowerFind, not PowerFind Pro.

To get the parentheses, click the gear button, choose Match and then Found.

To get Found2, click the gear button, choose Match, then Found2.

I hope this helps. If not, post again and we'll all give it our best try.

--Craig
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: extract email addresses, Powerfind not working

Post by martin »

derekroff wrote:I tried Martin's macro, and I get the following error message:

Perl Error
Perl reported an error trying to run 'Extract email addresses (Derek)':
Oops, my apologies. Copying the macro text from Safari yields several non-breaking space characters, which Perl does not care for. Give this macro file a try instead.
Post Reply