In a different thread a user of Writer wants to prefix each email
addresss in a long list with a "<" sign.
The assumption is that the list is of the form: lastName firstName
emailAddress
so, for example:
Smith John [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Robinson Bill [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Jones Ivan [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
The user asks about a macro and is being given sound advice by Le
Maestro des Macros - Andrew Pitonyak.
However, it occurred to me that the problem could be solved using the
Regular Expression facility within Find & Replace so I set up a small
example using the three element list above.
The Find and Replace settings I used were (with Regular Expressions
turned on):
Find (.* )(.*)
Replace with \1<\2
My assumptions were
1. Within the "Find" part
a) the partial RE within the first pair of parentheses would match
everything up to and including the *second* space (REs are "greedy")
b) the partial RE within the second pair of parentheses would match the
email address
2. Within the "Replace" part
a) the "\1" would insert the string matched by the first pair of
parentheses (the full name)
b) the "<" would insert the necessary character as per the requirment
c) the "\2" would insert the string matched by the second pair of
parentheses (the email address)
Well, The assumptions about the "Find" proved to be correct.
**BUT**
the "\1" and "\2" don't work at all. Instead they are taken
**literally** so I ended up with each line in the list being "\1<\2".
IMHO this is completely at odds with how any user of REs would expect
them to have been implemented. Writer's Help clearly states that
parenthesised sub-expressions can be referred to by \1, \2 etc. The Help
does not say that \1, \2 etc. can be used within the replacement string
but I've been using them that way on any number of versions of Solaris,
UNIX, perl, Java etc. for years.
What am I missing, please? Or is it simply a bug?
Oh, I'm using OO 2.2.1 on Win XP Pro.
--
Harold Fuchs
London, England
Please reply *only* to [email protected]