At 18:21 21/12/2007 -0800, Dick Moores wrote:
To cut to the chase here, what I'm trying to do is create a macro that will find each URL in turn in a Write document, and change it into a hyperlink. My idea is to first find http:// and then either a space or a paragraph delimiter.

This is not at all easy, mainly because of the "greedy" nature of regular expressions: the expression will generally match more than you want it to. And it gets more complicated if your URLs may be followed by punctuation (full stop, comma, question mark, exclamation mark, colon, semi-colon, closing quotation marks - single or double, closing parenthesis, closing bracket: these, at least) or such things as tabs and line breaks.

Then enter a space. This, when done manually, turns a URL into a hyperlink.

The bad news - as has already been said - is that this does not work for you anyway. You can easily show this by searching just for "com" (or whatever some of your URLs end with) and replacing this with "com ". The replacement will work, but this does not stimulate recognition of the text as requiring a hyperlink in the way that typing a space does. The only reason I did not reply to your earlier request about this is that I have not (yet?) found a neat way to solve your problem. But not for the want of thinking!

I trust this helps (if not as much as you might hope).

Brian Barker


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

Reply via email to