Parsing the output of --list-keys

Werner Koch
Tue, 18 Jan 2000 13:44:58 +0100

On Mon, 17 Jan 2000, Jonas Steverud wrote:

> <>" is not hard since the number of characters
> from the left marging is 31 (i.e. (forward-char 31)). The problem is
> to get "Tony Nelson", "(optional comment)" and
> "".
What you should do here is RFC822 address parsing. Doing it with r.e. is not trivial. However, if this user ID is GnuPG generated it is easy to get all three parts: 1. part: Collect everything up to (but excluding) the first opening parenthesis or the first left angle bracket. 2. part: Only if you stopped at a parenthesis, collect everthing up to the closing parenthesis. Although it is not yet allowed, you might want to keep a counter of opening closing parenthesis. 3. part: Only if you have a left angle bracket, collect everything up to the right angle bracket. It should be easy to construct a sed,awk,perl r.e. for this.
> I have found a way of doing this with regexps so the problem is
> solved, but if --with-colons had put colons between the wanted parts
No that is not possible. -- Werner Koch at keyid 621CC013 Boycott Amazon! -